dynamic reverse proxy , by mapping port

Phyo Lwin lists at ruby-forum.com
Sat Jul 18 05:48:21 MSD 2009


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 ?
-- 
Posted via http://www.ruby-forum.com/.





More information about the nginx mailing list