Possible rewrite regular expression bug?

Igor Sysoev is at rambler-co.ru
Tue Jun 24 22:01:34 MSD 2008


On Tue, Jun 24, 2008 at 06:03:51PM +0200, Peter Hoang wrote:

> Furthermore, it seems like NGINX seems to decode the parameter in 
> rewrite rules. For example, I have the following rule:
> 
>       if ($args ~ ^q=([^&]+)$) {
>         set $q $1;
>         rewrite ^/j /cms/q-$q.html? permanent;
>       }
> 
> Now if I enter the http://localhost/j?q=c%2B%2B then NGINX will redirect 
> me to http://localhost/cms/q-c++.html . I was expected that the final 
> url would be http://localhost/cms/q-%2B%2B.html. Is there a way to 
> prevent this from happening? Thanks.

It had been implemented long ago in 0.3.10:

    *) Bugfix: the "rewrite" directive did not unescape URI part in 
       redirect, now it is unescaped except the %00-%25 and %7F-%FF 
       characters.

Why do you need "c%2B%2B" in URL ? "c++" is valid unambiguous URL part.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list