<div dir="ltr"><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">By default, nginx 'cleanse' URI by decoding/correcting specific cases before matching it against a location. The multiple slashes are part of it.<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Read how <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#location">location</a> works.<br><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">I suppose the internal <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#var_uri"><span id="goog_857726247"></span><span id="goog_857726248"></span>$uri</a> variable holds watch nginx uses for its logic, but in any case holds a decoded/corrected version of the URI.<br><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">If you <b>do not</b> want nginx to automatically try to correct multiple slashes, you can override the default configuration for the corresponding <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#merge_slashes">merge_slashes</a> directive.<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Be careful then: your locations won't match if they do not find any exact stanza suitable for them. ;o)<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">You will be up for the pain you asked for...<br></div><div class="gmail_extra"><div><font size="1"><span style="color:rgb(102,102,102)">---<br></span><b><span style="color:rgb(102,102,102)">B. R.</span></b><span style="color:rgb(102,102,102)"></span></font></div>
<br><div class="gmail_quote">On Mon, Oct 6, 2014 at 11:17 AM, Benoit Vasseur <span dir="ltr"><<a href="mailto:bvasseur@siliconsalad.com" target="_blank">bvasseur@siliconsalad.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Hi everybody,</span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">I am in trouble with my nginx configuration.</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">my version of nginx is 1.1.19</span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">My goal is to redirect <a href="http://example.com//site" target="_blank">http://example.com//site</a> to <a href="http://example/site" target="_blank">http://example/site</a></span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">My app is in Rails and I want to handle this redirect with Rack.</span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">However I am not able to detect this ‘//’ in the url.</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Nginx send to my app ‘/site’ and not ‘//site’.</span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Seeing that my rails app had not the right info I tried to handle this redirection at the nginx level but I had the same issue ; I am not able to detect the ‘//’.</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">I tried to desactivate the merge slashes option but it did not change anything</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">$uri and $request_uri still contained ‘/site’ and not ‘//site’</span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Do you have any idea why the first slash is skip ?</span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">I tried to follow some examples but nothing worked :/</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><a href="http://rosslawley.co.uk/archive/old/2010/01/10/nginx-how-to-url-cleaning-removing/" target="_blank">http://rosslawley.co.uk/archive/old/2010/01/10/nginx-how-to-url-cleaning-removing/</a></span></p><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><a href="http://bneijt.nl/blog/post/nginx-and-the-extra-slashes/" target="_blank">http://bneijt.nl/blog/post/nginx-and-the-extra-slashes/</a></span></span><br></div>
<br>_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br></blockquote></div><br></div></div>