Welcome! Log In Create A New Profile

Advanced

Re: Proxy pass location inheritance

Maxim Dounin
February 17, 2014 12:32PM
Hello!

On Mon, Feb 17, 2014 at 05:15:45PM +0000, Brian Hill wrote:

> So it sounds like my only solution is to restructure the locations to avoid the original match in /. I don't have access to the servers again until tomorrow, but I'm wondering if something like this would work:
>
> location / {
> #base content
> }
>
> location ~ regex2 {
> #alternate folders to proxy_pass from .Net servers
> }
>
> location ~ regex3 {
> #catch all css, js, images, and other static files
>
> location ~ regex4 {
> #same as regex2. Alternate static location for .Net apps
> }
> location / {
> #match all "static files" not caught by regex4
> }
> }

This is certainly now how configs should be written, and this
won't work as regex4 will never match (and nested / will
complain during configuration parsing, but it doesn't make sense
at all).

> If I'm understanding location precedence correctly, the regex3
> location should always hit first, because its regex will contain
> an exact match for the file types. The nested regex4 (identical
> to regex2) will then match the folder name in that request, so
> the custom configuration can be applied only to the regex3 file
> types contained within the regex4 folders. Requests for the
> regex3 file types at locations not matching regex4 will be
> handled by the nested /.
>
> Will this work, or will the second nested / location break things?

Try reading http://nginx.org/r/location again, and experimenting
with trival configs to see how it works.

Try to avoid using regular expressions by all means at least till
you'll understand how it works. It's very easy to do things wrong
using regular expressions.

--
Maxim Dounin
http://nginx.org/

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

Proxy pass location inheritance

brih February 13, 2014 01:44PM

Re: Proxy pass location inheritance

Maxim Dounin February 14, 2014 07:22AM

RE: Proxy pass location inheritance

brih February 17, 2014 03:56AM

Re: Proxy pass location inheritance

Francis Daly February 17, 2014 04:18AM

Re: Proxy pass location inheritance

Maxim Dounin February 17, 2014 08:14AM

RE: Proxy pass location inheritance

brih February 17, 2014 12:16PM

Re: Proxy pass location inheritance

Maxim Dounin February 17, 2014 12:32PM

RE: Proxy pass location inheritance

brih February 17, 2014 04:28PM

Re: Proxy pass location inheritance

Maxim Dounin February 18, 2014 07:14AM

RE: Proxy pass location inheritance

brih February 18, 2014 01:18PM

Re: Proxy pass location inheritance

Igor Sysoev February 19, 2014 02:44AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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