Nginx case-insensitive reverse proxy rewrites
Posted
by
BrianM
on Server Fault
See other posts from Server Fault
or by BrianM
Published on 2012-11-09T21:44:35Z
Indexed on
2012/11/09
23:04 UTC
Read the original article
Hit count: 823
I'm looking to setup an nginx reverse proxy to make some upcoming server moves and load balanced implementations much easier within our apps. Since our servers are all IIS case sensitivity hasn't been an issue, but now with nginx it's becoming one for me. I am simply looking to do a rewrite regardless of case.
Infrastructure notes:
- All backend servers are IIS
- Most services are WCF services
- I am trying to simplify the URLs so I can move services around as we continue to build out
I can't set my location to case insensitive due to the following error:
nginx: [emerg] "proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or inside "limit_except" block in /etc/nginx/sites-enabled/test.conf:101
The main part of my conf file where I am trying to handle the rewrite is as follows
location /svc_test {
proxy_set_header x-real-ip $remote_addr;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header host $http_host;
proxy_pass http://backend/serviceSite/WFCService.svc;
}
location ~* /test {
rewrite ^/(.*)/$ /svc_test/$1 last;
}
It's the /test location that I can't get figured out. If I call http://nginxserver/svc_test/help
I get the WCF help page to display correctly and I can make all available REST calls. This HAS to be a boneheaded regex issue on my part, but I have tried several variations and all I can get are 404 or 500 errors from nginx. This is NOT rocket science so can someone point me in the right direction so I can look like an idiot and just move on?
© Server Fault or respective owner