1
0
Fork 0

add hsts header and https redirect for reverse proxy setups

This commit is contained in:
saibotk 2019-07-29 03:05:59 +02:00
parent 6a2f0ba6fe
commit bee69cfbad

View file

@ -36,6 +36,11 @@ http {
access_log off; access_log off;
error_log /var/log/nginx/pterodactyl.app-error.log error; error_log /var/log/nginx/pterodactyl.app-error.log error;
# Redirect to https
if ($http_x_forwarded_proto != false && $http_x_forwarded_proto != "https") {
return 301 https://$host$request_uri;
}
location / { location / {
try_files $uri $uri/ /index.php?$query_string; try_files $uri $uri/ /index.php?$query_string;
@ -48,7 +53,10 @@ http {
location = /robots.txt { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; }
sendfile off; sendfile off;
if ($http_x_forwarded_proto == "https") {
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains;";
}
add_header X-Content-Type-Options nosniff; add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block"; add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none; add_header X-Robots-Tag none;