Welcome! Log In Create A New Profile

Advanced

Re: location regex

Francis Daly
November 03, 2016 02:54PM
On Tue, Nov 01, 2016 at 06:49:04PM -0400, olat wrote:

Hi there,

> I am asking about regex in the context of caching some
> of the requests on front-end proxy to speed up django app loading dynamic
> content where session is involved. Does it mean each of the filtered out
> requests we would like to cache, should duplicate the same location block?

I think that a lot of this configuration will naturally inherit into
a location{} block, so you could potentially set the common pieces at
server{} level and just have the small number repeated in the individual
location{}s.

Or you could generate the nginx.conf fragment with lots of duplicate
content; you would only have a single source in your generator to change.

Or you could have the common config in an external file and "include"
it multiple times.

In general, you write the config a few times, and nginx reads it many
times. So it is often worth making it easy for nginx to reads, even at
the expense of making it harder for you to write.

> # catch only /appfoo* and /appbar*
> location ~ /app(foo|bar)* {

Another feature of regexen is that it is not always obvious what they
should do. For example, "/foo/app" and "/appbaz" will both match this
location.

(Effectively, the above is "does the request include the four-character
string /app anywhere?", which is not what the comment suggests that
you wanted.)

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Location regex

Mathew Davies October 27, 2009 08:30PM

Re: Location regex

Marcus Clyne October 27, 2009 09:00PM

Re: Location regex

Mathew Davies October 27, 2009 09:44PM

Re: Location regex

Marcus Clyne October 27, 2009 11:02PM

Re: Location regex

Michal Kowalski October 27, 2009 11:02PM

Re: Location regex

Igor Sysoev October 28, 2009 03:34AM

Re: Location regex

Mathew Davies October 28, 2009 10:56AM

Re: location regex

Igor Sysoev November 01, 2016 10:06AM

Re: location regex

olat November 01, 2016 06:49PM

Re: location regex

Igor Sysoev November 02, 2016 07:30AM

Re: location regex

Francis Daly November 03, 2016 02:54PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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