trailing slash at end URL with nginx as a reverse proxy for multiple website
António P. P. Almeida
appa at perusio.net
Sun Nov 20 08:40:13 UTC 2011
On 20 Nov 2011 08h11 WET, nam.nh at nd24.net wrote:
Oops it's the other way around.
If it's rewriting all the URIs so that they have a trailing slash then
try this:
1. At the http level:
map $request_uri $no_trailing_slash {
default 0;
~.*[^/]$ 1;
}
2. At the server level (vhost):
server {
listen 80;
server_name a.com;
location / {
if ($no_trailing_slash) {
return 302 $request_uri/;
}
proxy_pass http://10.0.0.2:8001;
proxy_redirect off;
server_name_in_redirect off;
}
}
--- appa
More information about the nginx
mailing list