Tuesday, August 23, 2011

HttpResponseRedirect adds hostname?

I've got a view which does returns HttpResponseRedirect('/'). When I look at the HTTP traffic in tcpdump, I can see that the location header has had the hostname added:

Location: http://gilbert.lic.songza.com/

Why does it do this? It seems like it should just take the string I passed it and stick that into the header, no?

The problem is that we've got a complicated setup with django (on port 9200) and apache (on port 80) both behind nginx (on port 9300). When I redirect to '/', my browser sees the absolute URL and ends up going to the apache server on port 80 (which is the wrong place; the nginx config would route to the django side).

It seems like a django bug that the string I pass HttpResponseRedirect is modified before generating the location header. What do you guys think?


---
Roy Smith
roy@panix.com

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment