Created
January 19, 2018 10:07
-
-
Save livioribeiro/146125a1ff8369eac2ac1550cc0c7c2b to your computer and use it in GitHub Desktop.
Simplest proxy to docker swarm services
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
# based on https://serverfault.com/questions/291703/dynamic-backends-with-haproxy/292581#292581 | |
server { | |
listen 80; | |
server_name *.localtest.me; | |
#charset koi8-r; | |
#access_log /var/log/nginx/host.access.log main; | |
resolver 127.0.0.11; | |
location / { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $host; | |
if ($host ~ (.*?)\.localtest\.me) { | |
set $_service $1; | |
proxy_pass http://$_service$request_uri; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment