Reverse proxy - variable
cboyke
nginx-forum at forum.nginx.org
Mon Jan 14 22:50:19 UTC 2019
I've seen this asked and answered many times - and I've tried many of the
suggestions posted, but still not able to get this to work.
I'm reverse-proxying to an internal IP inside an AWS VPC - eventually, I'd
like to use a JavaScript function to give the correct IP, but for now I'm
just hard-coding it in a variable.
I've tried all of the below, and none work:
server {
listen 80;
server_name myserver.com;
location / {
set $with_trailing_slash "http://172.31.17.123:8080/";
#proxy_pass http://172.31.17.123:8080/; #this works no
problem.
#proxy_pass $with_trailing_slash; # This gets to the
upstream but gives a 404;
#proxy_pass $with_trailing_slash$request_uri; # This spins
forever
set $no_trailing_slash "http://172.31.17.123:8080";
#proxy_pass $no_trailing_slash; #spins forever;
#proxy_pass $no_trailing_slash$request_uri; #spins forever;
set $just_ip 172.31.17.123;
#proxy_pass http://$just_ip:8080/; #404;
#proxy_pass http://$just_ip:8080/$request_uri; #spins
forever;
set $ip_in_quotes "172.31.17.123";
#proxy_pass http://$ip_in_quotes:8080/; #404;
#proxy_pass http://$ip_in_quotes:8080; # spins forever;
proxy_pass http://$iplookup:8080/; # spins forever;
}
}
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,282700,282700#msg-282700
More information about the nginx
mailing list