How to solid three urls into one url for its users

David Woodstuck leeon2013 at gmail.com
Mon Jul 17 04:07:22 UTC 2017


I just use Nginx for a couple of weeks. I have the following questions. I
hope I can get your help.

I have a big web application whose urls are dev01.mydomain.com,
dev02.mydomain and dev03.mydomain.com. I like to use Nginx to deliver this
application for its users. On each page, there are a lot of iframes whose
src can be one of dev01.mydomain.com, dev02.mydomain and dev03.mydomain.com.
I like to use following conf to achieve one url for its users:

server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;
        #access_log  /var/log/nginx/log/host.access.log  main;

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;

            proxy_pass http://dev01.mydomain.com/;
            subs_filter 'http://dev02.mydomain.com/(.*)' '
http://dev01.mydomain.com/?http://dev02.mydomain.com/$1';
            subs_filter 'http://dev03.mydomain.com/(.*)' '
http://dev01.mydomain.com/?http://dev03.mydomain.com/$1';
         }
}

My requirements are:
 (1). Request with url - http://www.mydomain.com/?http://... will proxy to
http://dev02.mydomain.com/ or http://dev03.mydomain.com/ depending on a
value after ?
 (2). Other request will proxy to http://dev01.mydomain.com/.

How do I achieve these requirements?

Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170717/81c3f5f6/attachment.html>


More information about the nginx mailing list