Files
hantim-server/docker/nginx/conf.d/thekims.family.conf
T
timothykim b7439b23e3 fix nginx security headers not being applied to https responses
nginx add_header inheritance meant X-Content-Type-Options and X-Frame-Options
were silently dropped from all https server blocks. moved all security headers
into a shared snippet (security-headers.inc) included per server block. added
pytest-based header verification that auto-discovers sites from conf files.
2026-03-20 15:11:56 -04:00

54 lines
1.3 KiB
Plaintext

# Redirect HTTP to HTTPS
server {
listen 80;
listen [::]:80;
server_name thekims.family www.thekims.family;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://thekims.family$request_uri;
}
}
# Redirect www to bare domain
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name www.thekims.family;
ssl_certificate /etc/letsencrypt/live/thekims.family/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/thekims.family/privkey.pem;
return 301 https://thekims.family$request_uri;
}
# Main site
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name thekims.family;
ssl_certificate /etc/letsencrypt/live/thekims.family/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/thekims.family/privkey.pem;
include /etc/nginx/conf.d/security-headers.inc;
location /media/ {
proxy_pass http://garage:3902/;
proxy_set_header Host thekims.family.web.garage;
}
location / {
proxy_pass http://thekims_family:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}