mujeeb
mujeeb

Reputation: 819

What is the HTTP response code to see a "Web page has expired" in internet explorer?

Can you please tell me what the is HTTP response code when we see a "Web page has expired" on the Internet Explorer?

Upvotes: 1

Views: 2855

Answers (2)

thomasrutter
thomasrutter

Reputation: 117403

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 containing no-store

    or

    • Cache-control: header containing must-revalidate

      and

      • Cache-control: header containing no-cache or similar

        or

      • Expires: header with a date that has expired

        or

      • 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.

Upvotes: 1

BalusC
BalusC

Reputation: 1109132

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:

  1. It was a HTTP POST request (thus, not GET! else the browser will just re-send it to the server).

  2. 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
    

Upvotes: 2

Related Questions