Welcome! Log In Create A New Profile

Advanced

Re: How to access query parameter names with '-' in it

Jonathan Kolb
November 13, 2014 09:40AM
You can also accomplish this without matching in a map:

map $pipe $dashed_param {
default $arg_param-name;
}

(I tried a geo block first, but it expanded to a literal '$arg_param-name'
for some reason)

On Wed, Nov 12, 2014 at 5:43 PM, Francis Daly <francis@daoine.org> wrote:

> On Wed, Nov 12, 2014 at 03:38:03AM -0500, sudarshan wrote:
>
> Hi there,
>
> > If query parameters in the request looks like this
> >
> > /something.cgi?param_name=1&param-name=2
> >
> > I can access 'param_name' as $arg_param_name. How do I access
> 'param-name'
> > though? $arg_param-name will not work since as far as nginx is concerned
> the
> > variable name ends at $arg_param. Is there a workaround for this case?
> Has
> > anyone else run into a similar problem?
>
> If you want to avoid embedded languages, you could match-and-extract
> from $args, either with a map or an if, to set your variable name to
> the matching value in "&?param-name=([^&]*)".
>
> But it might be less work to change the input to restrict itself to
> nginx-friendly characters.
>
> f
> --
> Francis Daly francis@daoine.org
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

How to access query parameter names with '-' in it

sudarshan November 12, 2014 03:38AM

Re: How to access query parameter names with '-' in it

sudarshan November 12, 2014 05:36AM

Re: How to access query parameter names with '-' in it

Francis Daly November 12, 2014 05:46PM

Re: How to access query parameter names with '-' in it

Jonathan Kolb November 13, 2014 09:40AM

Re: How to access query parameter names with '-' in it

Maxim Dounin November 13, 2014 09:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 235
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