Stripping out query parameter?

Maxim Dounin mdounin at mdounin.ru
Tue Mar 3 14:59:55 MSK 2009


Hello!

On Tue, Mar 03, 2009 at 03:08:06AM -0800, Neil Sheth wrote:

> Hmmm, I'm getting:
> 
> # nginx -t -c /etc/nginx/nginx.conf
> 2009/03/03 05:05:07 [emerg] 10550#0: invalid number of arguments in
> "set" directive in /etc/nginx/nginx.conf:170
> 2009/03/03 05:05:07 [emerg] 10550#0: the configuration file
> /etc/nginx/nginx.conf test failed
> 
> Not sure what the error is here.  Also, not sure if this rule belongs
> at the server level, or within my "location / " section . . .

[...]

> >>          if ($args ~* ^(.*)(&?)extra=yes$) {
> >>              set $stripped_params = $1;

-                 set $stripped_params = $1;
+                 set $stripped_params $1;

Maxim Dounin


> >>              rewrite ^(.*)$ $1$stripped_params permanent;
> >
> > -              rewrite ^(.*)$ $1$stripped_params permanent;
> > +              rewrite ^(.*)$ $1?$stripped_params? permanent;
> >
> >>          }
> >>
> >> Any thoughts?  I'm running 0.6.31.  Thanks!
> >
> > 1. Missing '?' to separate uri path and arguments.  Note that $args
> > doesn't contain leading '?'.
> >
> > 2. Without trailing '?' nginx will append original arguments to
> > resulting rewrite uri.
> >
> > Maxim Dounin
> >
> >
> 





More information about the nginx mailing list