Skip to content

Commit

Permalink
Add security headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Park committed Apr 16, 2024
1 parent 7798a79 commit 37ac3a5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion nginx/conf.d/django.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ upstream gunicorn {
server {
server_name {{DOMAIN}};
server_tokens off;

listen 8000;

root /app;
Expand Down Expand Up @@ -49,4 +48,16 @@ server {
proxy_set_header X-Forwarded-Ssl "";
proxy_pass http://gunicorn;
}

add_header X-Frame-Options SAMEORIGIN always;
add_header X-Content-Type-Options nosniff always;
add_header Strict-Transport-Security "max-age=31536000" always;
add_header Content-Security-Policy "default-src https: 'self';" always;
add_header Referrer-Policy "same-origin" always;
}

server {
listen 8000;
server_name ~^www\.(?<domain>.+)$;
return 301 https://$domain$request_uri;
}

0 comments on commit 37ac3a5

Please sign in to comment.