Skip to content

Enable HSTS headers on all responses #895

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

Merged
merged 6 commits into from
Aug 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .buildpacks
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
https://github.com/rcaught/heroku-buildpack-cmake#e4e2c9e
https://github.com/emk/heroku-buildpack-rust#578d630
https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/emberjs.tgz
https://github.com/ryandotsmith/nginx-buildpack.git#af813ba
https://github.com/travis-ci/nginx-buildpack.git#2fbde35
https://github.com/sgrif/heroku-buildpack-diesel#f605edd
14 changes: 1 addition & 13 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,7 @@
],
"buildpacks": [
{
"url": "https://github.com/rcaught/heroku-buildpack-cmake.git#e4e2c9e"
"url": "https://github.com/heroku/heroku-buildpack-multi"
},
{
"url": "https://github.com/emk/heroku-buildpack-rust.git#578d630"
},
{
"url": "https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/emberjs.tgz"
},
{
"url": "https://github.com/ryandotsmith/nginx-buildpack.git#af813ba"
},
{
"url": "https://github.com/sgrif/heroku-buildpack-diesel.git#f605edd"
}
]
}
33 changes: 18 additions & 15 deletions config/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ events {
}

http {
gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_min_length 512;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml image/svg+xml;
gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_min_length 512;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml image/svg+xml;

server_tokens off;

Expand All @@ -26,7 +26,7 @@ http {
sendfile on;

client_body_timeout 30;
client_max_body_size 50m;
client_max_body_size 50m;

upstream app_server {
server localhost:8888 fail_timeout=0;
Expand All @@ -36,20 +36,23 @@ http {
listen <%= ENV["PORT"] %>;
server_name _;
keepalive_timeout 5;
add_header Strict-Transport-Security "max-age=31536000";

location ~ ^/assets/ {
add_header Cache-Control public;
root dist;
expires max;
}
location ~ ^/assets/ {
add_header Strict-Transport-Security "max-age=31536000" always;
add_header X-Content-Type-Options nosniff;
add_header Cache-Control public;
root dist;
expires max;
}

location / {
add_header Strict-Transport-Security "max-age=31536000" always;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if ($http_x_forwarded_proto != 'https') {
rewrite ^ https://$host$request_uri? permanent;
}
if ($http_x_forwarded_proto != 'https') {
rewrite ^ https://$host$request_uri? permanent;
}
proxy_pass http://app_server;
}
}
Expand Down