Menu

#1 response.redirect()

open
nobody
None
5
2003-09-02
2003-09-02
Devin
No

When using response.redirect() with an absolute path
(e.g. response.redirect("/foo.dsp")), the response is
always redirected to the host specified in the virtual
host's ServerName directive (in httpd.conf), regardless
of whether or not the page the user is currently on
uses one of the names specified in the ServerAlias
directive.

For example, I have one of my virtual host directives
setup as follows:

<VirtualHost *>
AddHandler python-program .dsp
DirectoryIndex index.dsp index.html index.htm
DocumentRoot /home/whitebread/public_html
PythonAccessHandler draco.dracohandler
PythonHandler draco.dracohandler
PythonOption DocumentRoot /home/whitebread/public_html
ServerAlias whitebread.org whitebread
ServerName www.whitebread.org
UserDir public_html
</VirtualHost>

If I initially use the hostname "whitebread" to connect
to my http server locally, and later come to a page
that uses response.redirect("/foo.dsp") to redirect me,
the page my browser is redirected to will not be
"whitebread/foo.dsp"; instead, the page will be
"www.whitebread.org/foo.dsp". Any session cookies (or
any cookies set for the host "whitebread", for that
matter) immediately become invalid due to the hostname
change.

--
Devin
devin@whitebread.org

Discussion


Log in to post a comment.

MongoDB Logo MongoDB