auth_hash_secret

The `auth_hash_secret` directive sets the secret key used to create secure link hashes for authentication in NGINX.

Syntaxauth_hash_secret string;
Defaultnone
Contexthttp, server, location
Arguments1

Description

The auth_hash_secret directive is part of the NGINX Secure Link Hash module, which provides an additional layer of security for generating secure links. This directive is crucial because it specifies the secret key utilized in the hash construction process. The secure link is created by combining various parameters, including the message and the time, with the specified secret key. This hash is then used to authenticate requests by generating a secure token. If the token matches the one generated with the expected parameters and secret, access is granted; otherwise, it is denied.

The behavior and configuration of auth_hash_secret allows the user to specify the secret in a complex form that supports variables, which enables dynamic secret handling. This means that you can customize the secret based on request parameters or other runtime conditions. This flexibility can improve the security of the access links developed using this directive, as it can adapt to varying situations. The correct configuration of this directive is essential for maintaining the integrity and security of the secure links generated by NGINX.

Config Example

auth_hash_secret "my_secret_key";

Ensure the secret key is sufficiently complex to avoid brute-force attacks.

Avoid sharing the secret across multiple services or NGINX instances unless necessary.

Always use a secure hashing algorithm in conjunction with the secret to prevent predictable hashes.

← Back to all directives