security_headers_referrer_policy

The `security_headers_referrer_policy` directive sets the Referrer-Policy HTTP header in NGINX configurations.

Syntaxsecurity_headers_referrer_policy value;
Defaultomit
Contexthttp, server, location
Arguments1

Description

The security_headers_referrer_policy directive allows the user to specify the Referrer-Policy HTTP header, which dictates how much referrer information should be included with requests made from a page. This directive can take one of several predefined values, each representing different levels of referrer information exposure. The values include options such as 'no-referrer', which sends no referrer information, or 'strict-origin-when-cross-origin', which only sends the origin of the document as the referrer when navigating to a different origin, providing a greater level of privacy.

Setting this directive is crucial for controlling how much referrer information is shared with third parties and can help mitigate tracking concerns. Depending on the specified value, it can help secure user data by limiting the information that gets shared when a user navigates away from a page on your website. When properly configured, this directive enhances user privacy especially in cross-origin scenarios, thus aligning with current web security and privacy best practices.

Config Example

http {
    security_headers_referrer_policy strict-origin-when-cross-origin;
}

Ensure the value is correctly set to avoid unintentional exposure of referrer data.

Remember that some older browsers may not support all Referrer-Policy values, potentially affecting compatibility.

← Back to all directives