Skip to content

Instantly share code, notes, and snippets.

@rkaneko
Created October 3, 2017 10:08
Show Gist options
  • Select an option

  • Save rkaneko/19f9528fd6b53af4d8769e858904c728 to your computer and use it in GitHub Desktop.

Select an option

Save rkaneko/19f9528fd6b53af4d8769e858904c728 to your computer and use it in GitHub Desktop.
Dockerized nginx's proxy config example using variables for proxy_pass
server {
listen 80 default_server;
# real_ip_header X-Forwarded-For
# server_name localhost;
location ~ ^/graphql(.*) {
# see https://stackoverflow.com/questions/35744650/docker-network-nginx-resolver
resolver 127.0.0.11 ipv6=off;
set $target http://${SOME_HOST}:${SOME_PORT}/graphql;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass $target$1$is_args$args;
}
}
@rkaneko

rkaneko commented Oct 3, 2017

Copy link
Copy Markdown
Author

Prerequisites

  • Using envsubst for replacement environment variables when running docker container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment