# Proxy\_pass strangeness

**URL:** <https://www.ruby-forum.com/t/proxy-pass-strangeness/196162>\
**Category:** NGINX\
**Created:** [October 7, 2010, 5:52pm UTC](https://www.ruby-forum.com/t/proxy-pass-strangeness/196162 "2010-10-07T17:52:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![daveyfx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b487fb/32.png) [@daveyfx](https://www.ruby-forum.com/u/daveyfx)\
**Post date:** [October 7, 2010, 5:52pm UTC](https://www.ruby-forum.com/t/proxy-pass-strangeness/196162/1 "2010-10-07T17:52:29Z")

</div>

Hi all,

I’m having an odd issue in my current configuration. I have nginx on the  
front-end, which is handling static content and passing off dynamic  
content requests to Apache servers in the back end. I’m having an odd  
issue right now with one of my location directives, which performs a  
proxy\_pass function to an upstream Apache server.

server {  
listen \*:80;  
server\_name www.nstein.dev  
root /opt/nstein;  
access\_log off;  
error\_log off;  
index index.php index.html;

location / {  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
proxy\_set\_header Host $http\_host;

proxy\_pass http://nstein\_http\_cluster;  
}

location /blogs/ {  
access\_log /tmp/blogs\_access.log;  
error\_log /tmp/blogs\_error.log;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
proxy\_set\_header Host $http\_host;

proxy\_pass http://blogs\_http\_cluster/;  
proxy\_redirect off;  
}

Here’s the corresponding entry in the Apache vhost file:

Listen 81

ServerAdmin removed\_email\_address@domain.invalid  
DocumentRoot /opt/nstein/static/mte  
ServerName nsweb1.nstein.dev  
ServerAlias www.nstein.dev

ErrorLog /usr/local/apache2/logs/blog/error\_log  
CustomLog /usr/local/apache2/logs/blog/access\_log combined  
DirectoryIndex index.php

RewriteEngine On

The very odd behavior is that if I input a URL into my browser as such,  
the page loads fine:  
[http://www.nstein.dev/blogs/on\_call/](http://www.nstein.dev/blogs/on_call/)

However, if I leave out the trailing slash, the server performs a 301  
redirect. For instance:  
[http://www.nstein.dev/blogs/on\_call](http://www.nstein.dev/blogs/on_call) redirects my browser to  
[http://www.nstein.dev/on\_call](http://www.nstein.dev/on_call) and throws a 404.

The nginx access log displays the following (snipped down of course):  
“GET /blogs/on\_call HTTP/1.1” 301 238  
And oddly enough, Apache’s access/error logs show me nothing. Almost as  
if the request never hits Apache.

Any ideas? Thanks for your help!

Dave

Posted at Nginx Forum:

> **[proxy\_pass strangeness](https://forum.nginx.org/read.php?2,138173,138173#msg-138173)**
>
> Hi all, I'm having an odd issue in my current configuration. I have nginx on the front-end, which is handling static content and passing off dynamic content requests to Apache servers in the back end. I'm having an odd issue right now with one of my...
