Welcome! Log In Create A New Profile

Advanced

conditional proxy_pass

David Woodstuck
July 20, 2017 11:26AM
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,

David
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

conditional proxy_pass

David Woodstuck July 20, 2017 11:26AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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