Last active
May 22, 2025 19:00
-
-
Save R0GGER/916183fca41f02df1471a6f455e5869f to your computer and use it in GitHub Desktop.
Workaround - Security Headers @ NGINX Proxy Manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if certificate and certificate_id > 0 -%} | |
{% if ssl_forced == 1 or ssl_forced == true %} | |
{% if hsts_enabled == 1 or hsts_enabled == true %} | |
# HSTS (ngx_http_headers_module is required) (63072000 seconds = 2 years) | |
add_header Strict-Transport-Security "max-age=63072000;{% if hsts_subdomains == 1 or hsts_subdomains == true -%} includeSubDomains;{% endif %} preload" always; | |
add_header Referrer-Policy strict-origin-when-cross-origin; | |
add_header X-Content-Type-Options nosniff; | |
add_header X-XSS-Protection "1; mode=block"; | |
add_header X-Frame-Options SAMEORIGIN; | |
add_header Content-Security-Policy upgrade-insecure-requests; | |
add_header Permissions-Policy interest-cohort=(); | |
add_header Expect-CT 'enforce; max-age=604800'; | |
more_set_headers 'Server: Proxy'; | |
more_clear_headers 'X-Powered-By'; | |
{% endif %} | |
{% endif %} | |
{% endif %} |
Have you tried to change add_header
to more_set_headers
?
add_header Content-Security-Policy $hdr_content_security_policy;
add_header Permissions-Policy $hdr_permissions_policy;
more_set_headers "Content-Security-Policy $hdr_content_security_policy";
more_set_headers "Permissions-Policy $hdr_permissions_policy";
yes tried. it error too.
nginx: [emerg] unknown "hdr_content_security_policy" variable
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i getting error
nginx: [emerg] invalid number of arguments in "add_header" directive in /usr/local/nginx/conf/conf.d/include/hsts.conf:11