I have an Nginx that redirects to several different web servers based on URL path after host.
My Nginx host is nginx.main.com
current redirect rules are
# Redirects for Math
location ~ ^/(math)($|/) {
proxy_pass http://www.aaa.com:8081;
include /etc/nginx/proxy.conf;
break; }
# Redirects for CS
location ~ ^/(cs)($|/) {
proxy_pass http://www.aaa.com:8082;
include /etc/nginx/proxy.conf;
break; }
This causes
http://nginx.main.com/math/index.html to be redirected to http://www.aaa.com:8081/math/index.html
And
http://nginx.main.com/cs/index.html to be redirected to http://www.aaa.com:8082/cs/index.html
(My 2 aaa sites sit on IIS on two different ports and 2 different base dirs)
Because of IIS restrictions I dont want the '/math/' and '/cs/' to be added to the destination URL.
e.g., I want
http://nginx.main.com/math/index.htm to be redirected to http://www.aaa.com:8081/index.html
Is this possible with Nginx ?