Welcome! Log In Create A New Profile

Advanced

How to proxy to a backend specified in the url

Posted by jared 
How to proxy to a backend specified in the url
July 22, 2009 07:51PM
I'm trying to write a rule to proxy /varz requests to all my backends for a production dashboard. I'd like to specify the host and port in the request URL. Here's what I've tried, but I get a 502 Bad Gateway from nginx.

[code]
location /dashboard/varz {
if ($args ~ "host=([a-z0-9]*)&port=([0-9]*)") {
set $varz_host $1;
set $varz_port $2;
proxy_pass http://$varz_host.mydomain.com:$varz_port/varz;
}
proxy_redirect off;
...
}
[/code]

I'm running nginx/0.6.36. Any other suggestions?

Thanks,
Jared
Re: How to proxy to a backend specified in the url
August 11, 2009 07:17AM
Hi

I don't know how you could do what you are intending to do. But are you aware of that you would create an open proxy if you put that out into the wild?
Re: How to proxy to a backend specified in the url
August 11, 2009 12:05PM
Yes, I'm aware. The dashboard requires authentication (note the "..."). Thanks.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 185
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