Can you please tell me what the is HTTP response code when we see a "Web page has expired" on the Internet Explorer?
问题:
回答1:
There's no specific response code associated with this. That's just a browser default error page when the enduser attempts to request a non-cached POST request from the browser history.
So, in order to get such an error page when the user browses back in the history, then the following two conditions have to be met:
It was a HTTP POST request (thus, not GET! else the browser will just re-send it to the server).
It has the minimum necessary response headers which have instructed the browser to not cache the response.
Cache-Control: no-cache,no-store,must-revalidate Pragma: no-cache Expires: 0
回答2:
If you get this message it means you're returning to a page which you previously reached by submitting information, but the page has expired from the cache.
Internet Explorer doesn't want to just blindly re-submit your information, in case it has consequences (like a double charge on your credit card). So it displays this warning.
Either you pressed the refresh button, or the page will have expired from the cache due to some sort of Cache-Control directive on the server, such as "must-revalidate" in combination with "no-cache" or an "Expires" date that has expired.
You should look for
Cache-control:
header containingno-store
or
Cache-control:
header containingmust-revalidate
and
Cache-control:
header containingno-cache
or similaror
Expires:
header with a date that has expiredor
Something else which would make the cache unsatisfiable such as an overly restrictive
Vary:
header.
A way to prevent this on the server-side is to use the Post/Redirect/Get strategy.