Skip to content

Instantly share code, notes, and snippets.

Created September 19, 2016 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/f6f0c3d2076fa208c0530c1c4787118c to your computer and use it in GitHub Desktop.
Save anonymous/f6f0c3d2076fa208c0530c1c4787118c to your computer and use it in GitHub Desktop.
server {
listen 80;
# Proxy settings
# resolver 127.0.0.11;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for;
# This nonsense is to force runtime (instead of boot-time) resolution of DNS
# so that Docker containers can be swapped, while being functionally
# equivalent to the following block:
#
# location /api/ {
# proxy_pass http://server/;
# }
#
# It rewrites the path, stripping the prefix of the location block, so that
# Rails doesn't have to be completely aware that it's nested under /api/.
location /api/ {
proxy_pass http://server/api/;
# set $upstream "http://server/";
# proxy_pass $upstream$1$is_args$args;
}
location / {
proxy_pass http://client/;
# set $upstream "http://client/";
# proxy_pass $upstream$1$is_args$args;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment