Possible rewrite regular expression bug?
Michal Mach
michal.mach at gmail.com
Thu Jul 23 15:13:47 MSD 2009
I don't know if this is related to the issues mentioned here, but when we
have rewrite rule like
rewrite ^/arch/(.*) /cgi-bin/open_cache.pl?file=$1 last;
and url
/arch/person2.php%2525253F%25252526st%2525253D1013880915.1.html.html
then in nginx 0.5 this will be passed to the cgi as
GET
/cgi-bin/open_cache.pl?file=person2.php%2525253F%25252526st%2525253D1013880915.1.html.html
HTTP/1.0
But in nginx 0.6 (maybe even in higher versions) is this url passed as
GET
/cgi-bin/open_cache.pl?basefile=person2.php%25253F%252526st%25253D1013880915.1.html.html
HTTP/1.0
As you can see some of the chars where unescaped.
2008/6/24 Igor Sysoev <is at rambler-co.ru>
> 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/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090723/07ee0d8a/attachment.html>
More information about the nginx
mailing list