# Not sure if it's passing to the proxy properly

**URL:** <https://www.ruby-forum.com/t/not-sure-if-its-passing-to-the-proxy-properly/182959>\
**Category:** NGINX\
**Created:** [February 5, 2010, 8:44am UTC](https://www.ruby-forum.com/t/not-sure-if-its-passing-to-the-proxy-properly/182959 "2010-02-05T08:44:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Matthews](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@James\_Matthews](https://www.ruby-forum.com/u/James_Matthews)\
**Post date:** [February 5, 2010, 8:44am UTC](https://www.ruby-forum.com/t/not-sure-if-its-passing-to-the-proxy-properly/182959/1 "2010-02-05T08:44:53Z")

</div>

Hi,

I am passing my requests like this  
if ( -f $request\_filename){  
expires 30d;  
break;  
}  
proxy\_pass [http://127.0.0.1:20000](http://127.0.0.1:20000);

However Apache is still serving everything (images included). How can I  
get  
it to move only through nginx (for images and other files).

James

---

<div class="post-metadata">

**Author:** ![James\_Matthews](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@James\_Matthews](https://www.ruby-forum.com/u/James_Matthews)\
**Post date:** [February 5, 2010, 10:30am UTC](https://www.ruby-forum.com/t/not-sure-if-its-passing-to-the-proxy-properly/182959/2 "2010-02-05T10:30:48Z")

</div>

Hello!

On Fri, Feb 05, 2010 at 02:43:58AM -0500, James Matthews wrote:

> it to move only through nginx (for images and other files).  
> Try this:

```
location / {
    try_files $uri @fallback;
    expires 30d;
}

location @fallback {
    proxy_pass http://127.0.0.1:20000;
}

```

Maxim D.

---

<div class="post-metadata">

**Author:** ![James\_Matthews](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@James\_Matthews](https://www.ruby-forum.com/u/James_Matthews)\
**Post date:** [February 5, 2010, 10:36am UTC](https://www.ruby-forum.com/t/not-sure-if-its-passing-to-the-proxy-properly/182959/3 "2010-02-05T10:36:04Z")

</div>

On Fri, Feb 05, 2010 at 12:30:12PM +0300, Maxim D. wrote:

> > }  
> > }
> 
> ```
> location @fallback {
> proxy_pass http://127.0.0.1:20000;
> }
> 
> ```

And do not forget about “root”. Probably this was a cause why

if (-f $request\_filename) {

did not work. However, anyway you should use try\_files instead of “if”.

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![James\_Matthews](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@James\_Matthews](https://www.ruby-forum.com/u/James_Matthews)\
**Post date:** [February 5, 2010, 10:57am UTC](https://www.ruby-forum.com/t/not-sure-if-its-passing-to-the-proxy-properly/182959/4 "2010-02-05T10:57:08Z")

</div>

Hello!

On Fri, Feb 05, 2010 at 12:35:45PM +0300, Igor S. wrote:

> > > ```
> > > expires 30d;
> > > 
> > > ```
> > 
> > ```
> > try_files $uri @fallback;
> > 
> > ```
> 
> did not work. However, anyway you should use try\_files instead of “if”.

In the original config proxy\_pass is configured at location level,  
and “if” won’t “de-configure” it (r-\>content\_handler will be set at  
location level, and will be used inside implicit location created  
by “if”).

There is nothing wrong in original config, it works as expected.  
It just doesn’t prevent proxy\_pass from executing.

Maxim D.
