Artem Tikhomirov
Artem Tikhomirov

Reputation: 21686

Redirect to referer cache problem

We've faced strange problem. We have log on service, that authenticates user, adds auth cookie and, finally redirects user to the page she posted to this service from.

So almost in all cases everything is OK. But on sometime on some random machine occurs a bug in this logic. Source page look and feel differs if user is authenticated. But browser do not fetch new version of the page after being redirected to it from log in service - it shows old version from the cache. Why so?

Upvotes: 1

Views: 849

Answers (1)

KJ Saxena
KJ Saxena

Reputation: 21828

You guessed it right - it is a cache problem. The concerned page is being cached. Try this with the concerned page:

<meta http-equiv="pragma" content="no-cache">

However, this is not a foolproof method and leaves you at the mercy of the browser, the proxy and the weather..

A better but more nasty method is to redirect to a url with a random GET field like:

www.yoursite.com/dir/yourpage.php?rand=342384

This will cause the browser to think that a new page is being requested and the earlier page, even if cached, will not be retrieved.

Upvotes: 1

Related Questions