keep original proto header if exists

This commit is contained in:
Luc 2021-12-07 10:57:45 +01:00
parent 4444367d67
commit c7a281c78e
1 changed files with 8 additions and 3 deletions

View File

@ -44,9 +44,16 @@ http {
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
# if x-forwarded-proto header is set to https keep the header
map $http_x_forwarded_proto $real_proto {
default "http";
"https" "https";
}
server {
listen 4848;
listen [::]:4848;
server_name _;
root /docs;
index index.html;
@ -54,12 +61,10 @@ http {
proxy_buffers 32 4k;
proxy_set_header Connection "";
server_name _;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host localhost;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto $real_proto;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;