[mod_python] Redirect from publisher - again...

Sean Holdsworth sh at hob.cx
Tue Oct 1 18:02:44 EST 2002

I'm having a problem getting redirects working from a publisher handler.
I've seen the item in the FAQ (and can get redirection from
non-publisher handlers working fine). This issue also seems to crop up
fairly often in the mod_python list. Grisha has answered the question
before with the following example code.

req.headers_out['location'] = 'http://www.modpython.org/'
req.status = apache.HTTP_MOVED_TEMPORARILY
return "You are being redirected to http://www.modpython.org/"

When I run this I get the "You are being redirected..." message
displayed, and it just sits there. I've been trying to get this to work
for a couple of days and am beginning to wonder if it could be an Apache
setting that is causing the problem?

In addition to the publisher handler I have one handler, the
PythonAccessHandler configured. I use this to manage cookies and
redirect to a login page if the client hasn't authenticated. The
login page has a form with an action that causes the handler that
I'm trying to redirect out of to be run.

I'm running Apache 1.3.23 and  mod_python 2.7.8 with python 2.2 on
Mandrake 8.2 Linux. Could someone please run the above code
fragment as a policy handler and confirm that it is just me and my
configuration that has the problem?

Thanks, Sean

More information about the Mod_python mailing list