How to fix nginx server returning 302 redirect instead of 200

Richard Stanway r1ch+nginx at teamliquid.net
Sat Dec 19 17:06:55 UTC 2015


This doesn't seem to be an nginx issue. The presence of the "X-Powered-By:
HHVM/3.11.0" in your response means your backend is the one issuing the 302
redirect, so you should investigate that instead of nginx.

On Sat, Dec 19, 2015 at 5:11 PM, Xavier Cardil Coll <info at elsitar.com>
wrote:

> On this setup, there is a server directive listening to port 80 that
> returns www to non www and returns 80 to 443.
>
> The second server is Nginx as SSL terminator, so it's an SSL virtual host,
> that proxies the request to Varnish, and the last server is the last host
> on the chain, that processes and serves back the requests.
>
> Now, when I bypass the chain and do a `curl -v 127.0.0.1:8081` ( this is
> the backend vhost, the last in the chain ) I get a 302 redirect instead a
> 200. This is causing problems on my CMS and also with Varnish communicating
> to the backend.
>
>     This is the curl response :
>
>     * Rebuilt URL to: 127.0.0.1:8081/
>     * Hostname was NOT found in DNS cache
>     *   Trying 127.0.0.1...
>     * Connected to 127.0.0.1 (127.0.0.1) port 8081 (#0)
>     > GET / HTTP/1.1
>     > User-Agent: curl/7.38.0
>     > Host: 127.0.0.1:8081
>     > Accept: */*
>     >
>     < HTTP/1.1 302 Found
>     * Server nginx/1.9.9 is not blacklisted
>     < Server: nginx/1.9.9
>     < Date: Sat, 19 Dec 2015 16:04:14 GMT
>     < Content-Type: text/html
>     < Transfer-Encoding: chunked
>     < Connection: keep-alive
>     < X-Powered-By: HHVM/3.11.0
>     < Vary: Accept-Encoding
>     < Location: https://domain.com
>     <
>     * Connection #0 to host 127.0.0.1 left intact
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20151219/d2cc7670/attachment.html>


More information about the nginx mailing list