Welcome! Log In Create A New Profile

Advanced

Reverse proxy - variable

January 14, 2019 05:50PM
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;
}
}
Subject Author Posted

Reverse proxy - variable

cboyke January 14, 2019 05:50PM

Re: Reverse proxy - variable

Francis Daly January 15, 2019 05:00PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 187
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready