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

Make nginx dev config respect forwarded proto. #171

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion src/snovault/nginx-dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ http {
server 127.0.0.1:6543;
keepalive 10;
}

map $http_x_forwarded_proto $forwarded_proto {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if I follow this it is just saying to use http/https based on value of http_x_forwarded_proto or scheme. Although I am not sure how these are set.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It's using the X-Forwarded-Proto header if it exists and the scheme if it doesn't. That header is set by a downstream proxy server (in my case the Google Cloud Integrated Authentication Proxy I use for authentication.) I needed this so I could test my authentication setup locally.

default $http_x_forwarded_proto;
'' $scheme;
}

server {
listen 8000;
location / {
Expand All @@ -20,7 +26,7 @@ http {
}
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto $forwarded_proto;
proxy_pass http://app;
proxy_set_header Connection "";
}
Expand Down