# Proxy pass location inheritance

**URL:** <https://www.ruby-forum.com/t/proxy-pass-location-inheritance/239135>\
**Category:** NGINX\
**Created:** [February 13, 2014, 7:43pm UTC](https://www.ruby-forum.com/t/proxy-pass-location-inheritance/239135 "2014-02-13T19:43:33Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Brian\_Hill](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecd19e/32.png) [@Brian\_Hill](https://www.ruby-forum.com/u/Brian_Hill)\
**Post date:** [February 14, 2014, 1:20pm UTC](https://www.ruby-forum.com/t/proxy-pass-location-inheritance/239135/2 "2014-02-14T13:20:15Z")

</div>

Hello!

On Thu, Feb 13, 2014 at 06:43:08PM +0000, Brian Hill wrote:

> Hello, we are using NGINX to serve a combination of local and  
> proxied content coming from both an Apache server (mostly PHP  
> content) and IIS 7.5 (a handful of third party .Net  
> applications). The proxy is working properly for the pages  
> themselves, but we wanted set up a separate location block for  
> the “static” files (js, images, etc) to use different caching  
> rules. In theory, each of the static file location blocks should  
> be serving from the location specified in its parent location  
> block, but instead ALL image requests are being routed to the  
> root block.

[…]

> ALL of the requests for the static files. Anyone have any idea  
> what I’m doing wrong?

Simplified:

```
location / {
    location ~ regex1 {
        # regex inside /
    }
}

location ~ regex2 {
    # regex
}

```

The question is: where a request matching regex1 and regex2 will  
be handled?

The answer is - in “location ~ regex1”. Locations given by  
regular expressions within a matching prefix location are tested  
before other locations given by regular expressions.

–  
Maxim D.

> **[nginx](http://nginx.org/)**

---

_[View the full topic](https://www.ruby-forum.com/t/proxy-pass-location-inheritance/239135)._
