Last active
February 11, 2020 21:45
-
-
Save zahna/649b634048d758f513a6cd9925c5c61b to your computer and use it in GitHub Desktop.
nginx proxy to different local backend sites, depending on a variable
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
map $http_x_forwarded_for $backend_site { | |
~^[6] www1.zahna.com; | |
default www2.zahna.com; | |
} | |
server { | |
listen 80; | |
listen 443 ssl; | |
server_name dfas78dsf9sa.cloudfront.net; | |
access_log /dev/null; | |
location / { | |
proxy_set_header Host $backend_site; | |
proxy_set_header X-Forwarded-Host $host; | |
proxy_pass http://127.0.0.1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment