How can i fix that? Code: Warning: Unnecessary HSTS header over HTTP in my website Nginx Directives i have Code: add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
You can e.g try this: Code: if ($scheme == "https") { add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; }
Code: WARNING - Reason for nginx restart failure: nginx: [emerg] unexpected "==" in condition in /etc/nginx/sites-enabled/100-example.com.vhost:147 nginx: configuration file /etc/nginx/nginx.conf test failed
Code: WARNING - Reason for nginx restart failure: nginx: [emerg] "add_header" directive is not allowed here in /etc/nginx/sites-enabled/100-example.com.vhost:148 nginx: configuration file /etc/nginx/nginx.conf test failed
Ok, then it might be that you can't use an if statement indeed. So the best option is probably to ignore the warning at all then.