Created
May 18, 2011 19:15
-
-
Save mitchellh/979302 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a nginx config snippet showing how to inherit an http header | |
# or defaulting it to a specific value. This is useful because it allows | |
# upstream load balancers to set specific headers, but if they're missing | |
# the app LB will know how to default it. | |
# This will inherit the previously set X-Scheme variable, or otherwise | |
# default it to the current `$scheme`. Requires nginx 0.9.0+. | |
# | |
# Docs: http://wiki.nginx.org/HttpMapModule#map | |
map $http_x_scheme $x_scheme { | |
"" $scheme; | |
default $http_x_scheme; | |
} | |
server { | |
listen 80; | |
# Use the inherited-or-defaulted $x_scheme var | |
proxy_set_header X-Scheme $x_scheme; | |
# And go to the app server! | |
proxy_pass http://frontends; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment