Created
October 3, 2017 10:08
-
-
Save rkaneko/19f9528fd6b53af4d8769e858904c728 to your computer and use it in GitHub Desktop.
Dockerized nginx's proxy config example using variables for proxy_pass
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
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites