Small bug in rewrite rules using if (ugh, yes, if is bad ...)

Peter Portante peter.a.portante at gmail.com
Wed Sep 28 01:30:40 UTC 2011


On Wed, Aug 31, 2011 at 11:52 AM, Maxim Dounin <mdounin at mdounin.ru> wrote:

> Hello!
>
> On Wed, Aug 31, 2011 at 11:26:29AM -0400, Peter Portante wrote:
>
> > Hello folks,
> >
> > Just thought I would report a small bug with rewrite interacting with if.
> >
> > Here is my simple setup:
> >
> > server  {
> >     server_name     example.dev.com;
> >     location    ^~  /salad/add {
> >         if ($arg_paramThree = "foobar") {
> >             rewrite     ^
> > https://example.this.com?PARAM_ONE=$arg_paramOne&PARAM_TWO=$arg_paramTwo
> ?
> > redirect;
> >         }
> >         proxy_pass      http://127.0.0.1:8080$request_uri;
> >     }
> > }
> >
> > So when I hit the server with this URL:
> >
> >
> http://example.dev.com/salad/add?paramThree=foobar&paramTwo=two&paramOne=one
> >
> >
> > It is rewritten to be:
> >
> > https://example.this.com?PARAM_ONE=one&PARAM_TWO=two?paramThree=foobar
> >
> >
> > If I use the following if conditional, the behavior is as expected:
> >
> > if ($args ~ "paramThree=foobar") {
>
> Works ok here.  Which nginx version do you use?
>

1.0.4

thanks for taking the time to check it out.


>
> Maxim Dounin
>
> _______________________________________________
> 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/20110927/1992fb6e/attachment.html>


More information about the nginx mailing list