[mod_python] Setting content location

Gregory (Grisha) Trubetskoy grisha at modpython.org
Wed Apr 16 21:33:56 EST 2003

First, make sure that you're setting headers prior to the first byte of
output written, because otherwise the headers have gone out already and
setting them is meaningless.

If that doesn't help it, please provide more info about your environment.
Note that mod_python 3.0.1 (and all prior versions) had a bug that would
not send headers correctly if you were using a DirectoryIndex directive
pointing to a mod_python handled location.


On Thu, 17 Apr 2003, Robert Leftwich wrote:

> I'm a newbie playing with mod_python (which I think is great, so far at
> least :-)) and I need to set a header to be returned to the client after
> processing an http post request. In my case I want to set the
> Content-Location header to a newly created URL  (fyi I'm attempting to
> implement a REST-based web service) and I have the following code in the
> handler :
> def handler(req):
>      if req.method == 'POST':
>         ...
>          req.headers_out["Content-Location"] = "/foo/bar"
>          return apache.HTTP_CREATED
> But I don't see the Content-Location header being set in my client. What am
> I missing?
> Robert
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list