[mod_python] cookies and redirects

John Aherne johna at johnaherne.co.uk
Sat Nov 6 04:28:35 EST 2004


mike bayer wrote:

>>John Aherne wrote:
>>External redirect, particularly a 307 redirect for HTTP/1.1 clients, is
>>generally the best way to handle changing a location in response to a
>>request.  Using a 307 means the client's back button works right, reload
>>works right, and the URL location bar works right.
>>
>>    
>>
>
>I have never seen a 307 redirect used before, so I will admit my ignorance
>of it as well as its usablity.  But big sites like Yahoo! etc. use "302
>Found" combined with the Location: header (I just double checked) to send
>the client elsewhere, as does the "Redirect" directive in Apache.
>
>Which is not to say the 307 is not a better way, but is it very well
>supported and predictable across all browsers ?
>
>If you really want a seamless redirect with zero side effects, an internal
>redirect, i.e. an server-side change of output within the scope of one
>request, is best, if your application can support them.
>
>Also, an external redirect is often used specifically to prevent reloads
>and back button usage, as in the case of an ecommerce submit form that you
>dont want submitted a second time by accident.
>
>I tend to use external redirects only for that reason, i.e. to prevent
>form reloads, and otherwise internal redirects for everything else, which
>are particularly useful since you can more easily preserve the request
>state among the original and redirected pages.
>
>- mike
>
>_______________________________________________
>Mod_python mailing list
>Mod_python at modpython.org
>http://mailman.modpython.org/mailman/listinfo/mod_python
>
>  
>
Am I mistaken. But I thought I needed to do an external rediect to get 
back the cookie I had just set from the browser.

I assumed that an internal redirect would not do this.

John Aherne




More information about the Mod_python mailing list