Welcome! Log In Create A New Profile

Advanced

Seeking for dynamic proxy_pass solution

March 10, 2014 05:49AM
Hello,

I'd like to achieve something as follow using nginx -

When browsing to http://myserver/10.10.21.102 for example,
I want proxy_pass to be set to http://10.10.21.102;

Im getting somewhere but still need help,
Catching the argument this way -
http://server/?device=10.10.21.102

In nginx config -
set $ip $arg_device;
proxy_pass http://$ip;

Which actually works but breaks when there's an image/css/js, for example -
[09/Mar/2014:23:05:44 +0200] "GET /?device=10.10.21.102 HTTP/1.1" 200 689 "-" "Mozilla/4.0 ...
[09/Mar/2014:22:58:30 +0200] "GET /welcome.png HTTP/1.1" 500 594 "http://server/?device=10.10.21.102" "Mozilla/4.0 ...

When I try to access http://server/?device=10.10.21.102/welcome.png - It works.

What would be the easiest way to solve this so css,js,images will be called as:
GET /?device=10.10.21.102/welcome.png
and not just
GET /welcome.png

Thank you,
D
Subject Author Posted

Seeking for dynamic proxy_pass solution

autogun March 10, 2014 05:49AM

Re: Seeking for dynamic proxy_pass solution

autogun March 14, 2014 02:15PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 144
Record Number of Users: 7 on October 18, 2016
Record Number of Guests: 386 on August 02, 2016
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready