From 3b8151bbaeb569753fc9ddcb4d66af40c2de036a Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Wed, 31 Jan 2024 16:27:23 +0100 Subject: HTTPd: Add security and cache headers. --- files/etc/nginx/sites-enabled/webmap | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/files/etc/nginx/sites-enabled/webmap b/files/etc/nginx/sites-enabled/webmap index 26df41b..e967535 100644 --- a/files/etc/nginx/sites-enabled/webmap +++ b/files/etc/nginx/sites-enabled/webmap @@ -27,6 +27,13 @@ server { ssl_certificate_key /etc/nginx/ssl/hel01.rsa.key; include snippets/ssl.conf; + add_header Referrer-Policy "no-referrer"; + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-Content-Type-Options "nosniff"; + add_header X-XSS-Protection "1; mode=block"; + add_header Strict-Transport-Security "max-age=31557600; includeSubDomains" always; + add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; font-src 'self'; frame-src 'self'; img-src 'self' data: https://minkarta.lantmateriet.se/map/; script-src 'self'; style-src 'self'; frame-ancestors 'self'; form-action 'none'; base-uri 'self'"; + root /var/www/webmap; index index.html; @@ -43,6 +50,9 @@ server { } location = /_.txt { + # cache 404 responses + add_header Strict-Transport-Security "max-age=31557600; includeSubDomains" always; + add_header Cache-Control "public; max-age=86400" always; internal; } -- cgit v1.2.3