Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Dinamyc ip based reverse proxy

$
0
0
Hi guys, Im new using nginx , I would like to try the reverse proxy feature.
I need to achieve this:
Lets supose my nginx server is at 10.1.1.254 , I would like to forward my request according to url data , for example:

If I request http://10.1.1.254/192.168.100.1. The reverse proxy should bring http://192.168.100.1.

So far I build some server block , according to some readings but it is not working.
This is what I have:

server {
listen 80;
server_name localhost;

location ~ /\b(?:\d{1,3}\.){3}\d{1,3}\b/ {
proxy_pass http://$1;
}

}

Note:
the regexp : /\b(?:\d{1,3}\.){3}\d{1,3}\b/ has succesfully been tested with pcretest:

re> /\b(?:\d{1,3}\.){3}\d{1,3}\b/
data> 192.168.100.2
0: 192.168.100.2

But:
Nginx claims that can not compile filter:
[emerg] 7659#7659: pcre_compile() failed: missing ) in "\b(?:\d" in>e

Ok ... Any idea would be wellcome,
Leandro.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>