Welcome! Log In Create A New Profile

Advanced

Re: Nginx location - Distinguish requests by arguments or queries

Francis Daly
February 27, 2020 06:32PM
On Thu, Feb 27, 2020 at 02:20:45PM -0500, stmx38 wrote:

Hi there,

> 1. "~*" to be "~^"
> The first one looks like Nginx regexp we can use for locations, but the
> second one not (^~):

"map" is documented at http://nginx.org/r/map

"~" means "this arg is a regex, not a string". "~*" means "and that regex
is case-insensitive". The rest of the argument is the regex; in that,
"^" means "match the start of the string".

So "~^GET/test" in this case will match all GET requests that start with
"/test". "~GET/test" would also match any requests that include the
8-character sting GET/test, which is probably not what you want.

> 2. It seems that the order of records in map is important. We pass required
> queries with args, we block then all queries with args and allow without
> args a then default value is applied. Maybe you can provide more details
> here.

Yes, the order is important. Per the docs: the first matching regex is
the regex that counts.

So - if you have some things which are subsets of some other things,
you must put the more specific ones earlier in the config list.

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx location - Distinguish requests by arguments or queries

stmx38 February 25, 2020 07:05AM

Re: Nginx location - Distinguish requests by arguments or queries

Francis Daly February 25, 2020 12:08PM

Re: Nginx location - Distinguish requests by arguments or queries

Francis Daly February 26, 2020 03:50AM

Re: Nginx location - Distinguish requests by arguments or queries

stmx38 February 27, 2020 02:20PM

Re: Nginx location - Distinguish requests by arguments or queries

Francis Daly February 27, 2020 06:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 361
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready