# Proxy Pass Redirect Problem

**URL:** <https://www.ruby-forum.com/t/proxy-pass-redirect-problem/238043>\
**Category:** NGINX\
**Created:** [December 13, 2013, 6:20pm UTC](https://www.ruby-forum.com/t/proxy-pass-redirect-problem/238043 "2013-12-13T18:20:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [December 13, 2013, 6:20pm UTC](https://www.ruby-forum.com/t/proxy-pass-redirect-problem/238043/1 "2013-12-13T18:20:14Z")

</div>

Not sure if this is my configuration causing this symptom or openresty.

Here is whats happening.

If I try to access the store “admin”  
via: [http://mysite.com/admin](http://mysite.com/admin)

I am getting proxy redirects sent to my browser and seeing  
127.0.0.1:8000/admin in my address bar.

Not exactly the result I was looking for.

Any pointers where I should look?

Running ngx\_openresty/1.4.3.6

Here is my config

```
     location / {
         root html;
         index index.php index.html index.htm;
         try_files $uri @store;
     }
     location @wsgi {
             include uwsgi_params;
             uwsgi_pass unix://tmp/spften.sock;
     }

     location @store {
             include uwsgi_params;
             proxy_pass http://127.0.0.1:8000$uri;
             proxy_intercept_errors on;
             #recursive_error_pages on;
             error_page 404, 502 = @wsgi;
     }

```

Thanks in advance for any pointers.

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [December 13, 2013, 6:48pm UTC](https://www.ruby-forum.com/t/proxy-pass-redirect-problem/238043/2 "2013-12-13T18:48:52Z")

</div>

Hello!

On Fri, Dec 13, 2013 at 12:25:02PM -0500, david wrote:

> Not exactly the result I was looking for.  
> try\_files $uri @store;  
> }  
> location @wsgi {  
> include uwsgi\_params;  
> uwsgi\_pass unix://tmp/spften.sock;  
> }
> 
> ```
> location @store {
> include uwsgi_params;
> proxy_pass http://127.0.0.1:8000$uri;
> 
> ```

- 

```
            proxy_pass http://127.0.0.1:8000$uri;

```

- 

```
            proxy_pass http://127.0.0.1:8000;

```

See also docs here:

[http://nginx.org/r/proxy\_pass](http://nginx.org/r/proxy_pass)  
[http://nginx.org/r/proxy\_redirect](http://nginx.org/r/proxy_redirect)

Default proxy\_redirect should work for you if you’ll remove “$uri”  
as suggested above.

–  
Maxim D.  
[http://nginx.org/](http://nginx.org/)

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [December 15, 2013, 2:16am UTC](https://www.ruby-forum.com/t/proxy-pass-redirect-problem/238043/3 "2013-12-15T02:16:24Z")

</div>

Nevermind. I found my error.

I was doing kill -HUP and had a typo in my config.

I didnt notice until I checked the config.

Thank you its working as expected.

Sorry for the noise.

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [December 15, 2013, 2:02am UTC](https://www.ruby-forum.com/t/proxy-pass-redirect-problem/238043/4 "2013-12-15T02:02:23Z")

</div>

Maxim!

Thank you.

I must of missed something because it does not seem to solve my issue.

I removed the $uri param from the proxy\_pass.

I also tried adding proxy\_redirect

(But I think that belongs to the @wsgi block and not the @store block.  
But I am not exactly sure.)

Because my understanding is that its getting sent to the @wsgi app thats  
what is issuing the redirect and using the proxy pass address to rewrite  
the uri.

location @wsgi {  
include uwsgi\_params;  
uwsgi\_pass unix://tmp/spften.sock;  
}

location @store {  
include uwsgi\_params;  
proxy\_pass [http://127.0.0.1:8000](http://127.0.0.1:8000);  
proxy\_redirect [http://127.0.0.1:8000](http://127.0.0.1:8000) /;

# proxy\_redirect default;

```
             proxy_intercept_errors on;
             #recursive_error_pages on;
             error_page 404, 502 = @wsgi;
     }

```

Perhaps I misunderstood how this works.

Thanks in advance for any pointers.
