views:

224

answers:

3

We are working on a new web site using Apache, Python and Django.

In the development phase, no problem but once binding to Apache, using Firefox 3.5.3, we got a strange problem.

We stand on :

http://website.fr/search/

When we want to change the ordering of the research, we are sending the user to :

http://website.fr/search/order/price/

This page change a session variable and redirect, with code 302, to :

http://website.fr/search/

The problem is that Apache send a 302 Apache code and that Firefox doesn't refresh the page. We got the same problem when we are redirecting the user to the same page he was before.

How should we do to force the refresh of the page ?

A: 

How about redirecting to

http://website.fr/search/?ignoredvar=<random int>

Please provide the full http conversation If you need a better solution. The conversation can be traced using firebug or live http headers.

Btw. The above solution is the only one I know for similar bug in a flash on IE.

Piotr Czapla
+1  A: 

I'd say you're doing it wrong. The same URL should be the same page. Everything with HTTP and web browsers assume this, and when you don't follow this convention you're going to get yourself into trouble. Just add the search parameters and sort orders as query parameters to the URL.

Teddy
+2  A: 

What happens is, the browser asks for the new URL and via 302 gets redirected back to the previous one, which is in the cache and thus not refreshed. Adding a random integer, like Piotr is suggesting will solve the problem. For randomness you can use simple timestamp.

Implication of performing forward as you are doing makes your app unRESTful and prohibits user bookmarking the results - i wonder if it is really what you would like to do.

It might be worth a try to try and use 303 or 307 status code instead of 302, maybe that behaves differently.

See also: http://en.wikipedia.org/wiki/HTTP%5F302

http://en.wikipedia.org/wiki/Representational%5FState%5FTransfer

tm_lv
I use 303 most often, I think it may be the one you want.
Kev
http://code.djangoproject.com/ticket/6227Exactly. Thank you :)
Natim