Welcome! Log In Create A New Profile


Dinamyc ip based reverse proxy

Posted by leostereo 
Dinamyc ip based reverse proxy
January 31, 2019 09:53AM
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 , I would like to forward my request according to url data , for example:

If I request The reverse proxy should bring

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;


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/

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,
Re: Dinamyc ip based reverse proxy
January 31, 2019 02:24PM
I make some improvements: using following server block:

server {
listen 8888;
server_name modem;

location ~ /(.*) {
proxy_pass http://$1;


It seems to be working but something is missing.
I can see that my browser is receiving data , and set the tab tittle but it can not complete all the web page.
In other cases it prints part of the page.
I dont know if the problem is related to javascript , routing ...

Any idea is wellcome.
Re: Dinamyc ip based reverse proxy
February 01, 2019 02:05PM
Other thing ...
It works if I use a hardcoded ip, like this :

server {
listen 8888;
server_name tozed;

location / {


And in the broser I do:

It brings all the web content ...

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 105
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready