Django HttpResponseRedirect acting as proxy rather than 302
Posted
by
Trevor Burnham
on Server Fault
See other posts from Server Fault
or by Trevor Burnham
Published on 2013-10-17T19:39:40Z
Indexed on
2013/10/17
21:59 UTC
Read the original article
Hit count: 281
I have a Django method that's returning
return HttpResponseRedirect("/redirect-target")
When running the server locally, if I visit the page that returns that redirect, I get the log output
[17/Oct/2013 15:26:02] "GET /redirecter HTTP/1.1" 302 0
[17/Oct/2013 15:26:02] "GET /redirect-target HTTP/1.1" 404 0
as expected.
But, when I visit that page in Chrome, the Network tab shows the request to /redirecter
with the response from /redirect-target
, rather than showing the 302. cURL does the same:
$ curl -I -X GET http://localhost/redirecter
HTTP/1.1 404 Not Found
date: Thu, 17 Oct 2013 19:32:30 GMT
connection: keep-alive
transfer-encoding: chunked
In production, the same Django code does show a 302 redirect in Chrome and cURL.
What could be going on here? Is there some kind of Django setting that might be causing it to proxy the target rather than send a redirect when HttpResponseRedirect
is used (but lie about it in the log)? Or is there a quirk on my system (OS X) that might cause localhost redirects to behave this way?
© Server Fault or respective owner