Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add security headers to nginx config #1244

Merged
merged 3 commits into from
May 14, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add security headers to nginx config
Increase the security of the nginx server and the served page, by adding the following security headers to the nginx config:
- X-Frame-Options (Disables click jacking by disallowing the page to be run in a frame/iframe)
- X-XSS-Protection (Enables cross site scripting filtering)
- X-Content-Type-Options (Disables MIME sniffing and forces browser to use the type given in Content-Type.)
- Content-Security-Policy (Controls resources the user agent is allowed to load for a given page.)
- Referrer-Policy (Governs which referrer information sent in the Referer header should be included with requests made.)

Additional headers that could be added optionally:
- Strict-Transport-Security (Enforce HTTPS over HTTP)
  • Loading branch information
Dalabad committed Apr 24, 2020
commit e3117c087f15512b3ec029624fac195222c23cd3
7 changes: 7 additions & 0 deletions config/docker/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ http {
server_name localhost;
index index.html index.htm;

# Add security headers
add_header X-Frame-Options deny always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options nosniff always;
add_header Content-Security-Policy "default-src 'none'" always;
add_header Referrer-Policy strict-origin-when-cross-origin always;

location / {
alias /usr/share/nginx/html/;

Expand Down