Welcome! Log In Create A New Profile

Advanced

ningx reverse proxy by dynamic port mapping

Posted by v3ss0n 
ningx reverse proxy by dynamic port mapping
July 17, 2009 09:57PM
Hi all,

I am trying to make a dynamic reverse proxy which proxies the local
webservers on different ports

I try doing this way :


#user nobody;
worker_processes 1;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;


server {
listen 0.0.0.0:8088;
server_name _;
access_log /var/log/nginx/proxy.access.log;

location /
{
set $rd_port $arg_port;
proxy_pass http://127.0.0.1:$rd_port$uri?port=$rd_port;
proxy_set_header Host $proxy_host;

}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

So when the page is requested using eg. http://10.0.0.1:8088/?port=12345
., it will redirect to http service running on 12345 . It work as expect
but only for one dynamic page / requested page, If that page have source
other static contents from its own it fails .

So to be make it possible need to put ?port=12345 on every links ,
images , etc.

How can i make it work as normally ?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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