nginx: security headers on every response (closes #18)
check / check (push) Successful in 1m13s
check / check (push) Successful in 1m13s
nginx sent none of the security headers REPO_POLICIES.md requires. security-headers.conf now sets all six with always, included at server level and again in /assets/, whose own add_header would otherwise drop them. nginx hides the copies netwatch-server sets, so /api/ and the health check carry each header once. The content security policy allows no inline script or style; the host row's status dot took its grey from a style attribute, now a class. connect-src is * because several probed hosts redirect to other hosts and the browser checks every redirect against it. Referrer-Policy is no-referrer, as the backend already sends. Model: opus-5-5
This commit is contained in:
+16
@@ -8,6 +8,11 @@ server {
|
||||
# Keep the nginx version out of the Server header and error pages.
|
||||
server_tokens off;
|
||||
|
||||
# The security headers, on every response. An add_header in a
|
||||
# location drops every add_header from here, so a location with one
|
||||
# of its own includes this file again.
|
||||
include /etc/nginx/security-headers.conf;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
@@ -32,6 +37,7 @@ server {
|
||||
location /assets/ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
include /etc/nginx/security-headers.conf;
|
||||
}
|
||||
|
||||
# netwatch-server, the Go backend, runs in the same container and
|
||||
@@ -45,6 +51,16 @@ server {
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# netwatch-server sets the same security headers on its own
|
||||
# responses. Its copies are dropped so that each header goes out
|
||||
# once, as security-headers.conf sets it.
|
||||
proxy_hide_header Strict-Transport-Security;
|
||||
proxy_hide_header Content-Security-Policy;
|
||||
proxy_hide_header X-Frame-Options;
|
||||
proxy_hide_header X-Content-Type-Options;
|
||||
proxy_hide_header Referrer-Policy;
|
||||
proxy_hide_header Permissions-Policy;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://127.0.0.1:8081;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user