secure_token_encrypt_uri

The `secure_token_encrypt_uri` directive enables secure encryption of URIs using configured cryptographic keys in NGINX.

Syntaxsecure_token_encrypt_uri on | off;
Defaultoff
Contexthttp, server, location
Argumentsflag

Description

The secure_token_encrypt_uri directive is part of the Secure Token module for NGINX and is used to enhance security by encrypting URIs of resources served by the web server. When this directive is enabled, the URIs requested by clients are encrypted using a specified key, which prevents unauthorized access and ensures that the resource links are not easily decipherable by third parties. This is particularly useful in environments where sensitive resources are delivered, and it helps maintain the integrity and confidentiality of those resources.

In terms of configuration, the directive accepts a single flag parameter, which can be set to 'on' or 'off'. When set to 'on', the encryption functionality is activated, allowing the secured URIs to be generated dynamically based on the incoming requests. The method of encryption employs HMAC with SHA-256, ensuring a strong layer of security for the tokens generated. The module also allows various configuration options, such as setting token expiration times and defining access control lists (ACLs) for better resource management based on security requirements.

Due to the nature of the cryptographic operations involved, performance considerations should be taken into account, especially under high load. It is also crucial to ensure that the key used for encryption is securely managed and not disclosed, as the security of the encrypted URIs heavily relies on the secrecy of this key.

Config Example

http {
    secure_token_encrypt_uri on;
    secure_token_key your-encryption-key;  
    ...
}

Ensure the encryption key is kept secret and secure to prevent unauthorized access.

If not configured correctly, clients may receive inaccessible resources due to URI encryption.

Monitor performance as encryption can introduce latency under heavy traffic.

← Back to all directives