Welcome! Log In Create A New Profile


proxy_pass strangeness

October 07, 2010 11:51AM
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
<VirtualHost *:81>
ServerAdmin xxx@xxx.com
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:

However, if I leave out the trailing slash, the server performs a 301 redirect. For instance:
http://www.nstein.dev/blogs/on_call redirects my browser to 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!

Subject Author Posted

proxy_pass strangeness

daveyfx October 07, 2010 11:51AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

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