set_base32_padding

The 'set_base32_padding' directive configures whether padding characters are added in Base32 encoding.

Syntaxset_base32_padding on | off;
Defaultoff
Contexthttp, server, location, if in server, if in location
Argumentsflag

Description

The set_base32_padding directive is part of the NGINX Set-Misc module and influences the behavior of Base32 encoding. By enabling padding with this directive, you ensure that the encoded string is aligned to a fixed length by appending = characters at the end of the output. This can be significant when the Base32 encoded output might be consumed by systems expecting such padding according to the Base32 specification. If padding is disabled, the encoded string may have variable lengths depending on the size of the input data, which might lead to compatibility issues with some applications.

The directive takes a single argument, which is a flag value. By setting this flag to 'on', padding will be applied to the Base32 encoded output; conversely, setting it to 'off' will result in no padding being added. This allows fine control over the encoding process, tailored to the specific requirements of the downstream systems that will interpret the Base32 encoded data.

Config Example

http {
    server {
        location / {
            set_base32_padding on;
            set $encoded_data $arg_data;
            set $result_data $encoded_data;
        }
    }
}

Ensure the downstream application can handle unpadded Base32 strings if padding is disabled.

Incorrect flag settings might lead to unexpected encoded string lengths.

Remember to apply padding if you're unsure about the Border32 compatibility of the application consuming the data.

← Back to all directives