Welcome! Log In Create A New Profile

Advanced

Re: Possible rewrite regular expression bug?

Michal Mach
July 23, 2009 07:13AM
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

> 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/
>
>
Subject Author Posted

Re: Possible rewrite regular expression bug?

Michal Mach July 23, 2009 07:13AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 191
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready