elstob
elstob

Reputation: 11

Why is Nginx malforming redirects for IP URLS without a trailing slash?

Requests to a URL of type 10.11.13.7/admin/ work as intended.

However a request for 10.11.13.7/admin (minus the trailing slash) attempts to redirect to 10.11.13.7,10.11.13.7/admin/ which I am assuming is NGINX trying to redirect to a URL with a trailing slash but failing for some reason.

To further confound things requests I make to mysite.dev/admin (mysite.dev is an entry in my local hosts file) redirect as expected, not failing as mysite.dev,mysite.dev/admin/ which I would have suspected.

My site.conf is very minimal:

server {
        listen  80 default_server;

        server_name  mysite.dev www.mysite.dev;
        root /vagrant;

        client_max_body_size 64M;

        location / {

            include proxy_params;
            proxy_pass http://unix:/tmp/gunicorn.sock;

            proxy_set_header      Host             $host;
            proxy_set_header      X-Real-IP        $remote_addr;
            proxy_set_header      X-Forwarded-For  $proxy_add_x_forwarded_for;

        }

}

I suspect NGINX is the culprit and not an internal redirect issue with the application as running the app with the django manage.py development server doesn't have this issue.

Thanks.

Upvotes: 1

Views: 112

Answers (1)

elstob
elstob

Reputation: 11

The problem ended up being

include proxy_params;

had a statement that wasn't being accounted for, setting a header that caused the software to have a fit.

Upvotes: 0

Related Questions