double slashes redirection
B.R.
reallfqq-nginx at yahoo.fr
Mon Oct 6 10:09:05 UTC 2014
By default, nginx 'cleanse' URI by decoding/correcting specific cases
before matching it against a location. The multiple slashes are part of it.
Read how location
<http://nginx.org/en/docs/http/ngx_http_core_module.html#location> works.
I suppose the internal $uri
<http://nginx.org/en/docs/http/ngx_http_core_module.html#var_uri> variable
holds watch nginx uses for its logic, but in any case holds a
decoded/corrected version of the URI.
If you *do not* want nginx to automatically try to correct multiple
slashes, you can override the default configuration for the corresponding
merge_slashes
<http://nginx.org/en/docs/http/ngx_http_core_module.html#merge_slashes>
directive.
Be careful then: your locations won't match if they do not find any exact
stanza suitable for them. ;o)
You will be up for the pain you asked for...
---
*B. R.*
On Mon, Oct 6, 2014 at 11:17 AM, Benoit Vasseur <bvasseur at siliconsalad.com>
wrote:
> Hi everybody,
>
> I am in trouble with my nginx configuration.
>
> my version of nginx is 1.1.19
>
> My goal is to redirect http://example.com//site to http://example/site
>
> My app is in Rails and I want to handle this redirect with Rack.
>
> However I am not able to detect this ‘//’ in the url.
>
> Nginx send to my app ‘/site’ and not ‘//site’.
>
> 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 ‘//’.
>
> I tried to desactivate the merge slashes option but it did not change
> anything
>
> $uri and $request_uri still contained ‘/site’ and not ‘//site’
>
> Do you have any idea why the first slash is skip ?
>
> I tried to follow some examples but nothing worked :/
>
>
> http://rosslawley.co.uk/archive/old/2010/01/10/nginx-how-to-url-cleaning-removing/
> http://bneijt.nl/blog/post/nginx-and-the-extra-slashes/
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20141006/bfceef3f/attachment.html>
More information about the nginx
mailing list