fix: add security headers to nginx configurations

- Add X-Frame-Options to prevent clickjacking attacks
- Add X-Content-Type-Options to prevent MIME-type sniffing
- Add Referrer-Policy for privacy protection
- Add Permissions-Policy to restrict unnecessary browser features
- Add HSTS header to SSL config for enforcing HTTPS connections
These headers are critical security measures that protect against
common web vulnerabilities and follow OWASP security best practices.
This commit is contained in:
Gurjit Singh
2025-11-28 12:38:56 +01:00
parent 38ec057eef
commit 50c95b3d27
2 changed files with 13 additions and 0 deletions

View File

@@ -18,6 +18,13 @@ server {
client_max_body_size 10M;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
location / {
try_files $uri $uri/ /index.html;
}

View File

@@ -8,6 +8,12 @@ server {
client_max_body_size 10M;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
location / {
try_files $uri $uri/ /index.html;
}