On Tue, Aug 23, 2011 at 3:50 PM, Roy Smith <r...@panix.com> wrote:
> Why does it do this?  It seems like it should just take the string I passed 
> it and stick that into the header, no?

No - that might seem intuitive, but it's incorrect. The HTTP standard
specifies that the Location header should contain an absolute URI (see
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30), so
Django's got to add one.

Practically, most web browsers correctly support relative URIs in
Location headers, but there're a lot more to consuming HTTP than just
browsers (spiders/crawlers, API clients, testing utilities, ...).

However, I believe it's not actually Django doing the rewriting. if
you peer through the implementation of HttpResponseRedirect
(https://code.djangoproject.com/browser/django/trunk/django/http/__init__.py#L689),
you'll see that i there's nowhere in that code path that's munging the
location header. The munging is I think being done by whatever web
server you're using (Apache? Nginx? It's hard to tell from your
description; you just say "Django on port 9200"), and that's where
you'd need to go to fix it. In Nginx, for example, I sometimes need to
mess with the proxy_redirect directive
(http://wiki.nginx.org/HttpProxyModule#proxy_redirect) to fix
situations like this.

Hope that helps,

Jacob

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to