Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
10.5k views
in Q2A Core by
edited by

I don't know if anybody noticed already, but in some cases navigating back in q2a brings up:

document expired

 

Only clicking "Try Again" which resends the data to the former site solves this issue.

But knowing users (and myself) I close the site when I get such an error message.

Question: Any way to prevent this?

 

PS: One example how you get the "document expired": Go to a q2a-site, logged out, then ask anonymously (just give a title), scroll down and use the link at "To avoid this verification in future, please log in or register.". Afterwards clicking the link, navigate back. that's it, you get the expired.

Q2A version: 1.5.1
by
"ISP proxy" I have no idea how I can find out about.

But strange enough that you don't get the same error. Maybe another member can perform steps 1 - 5 and confirm?
by
I confirm this problem many time. There are couple of things I have noticed. This issue appears especially when we submit any form or we pass dynamic data in theme or plugin for the page.

I would request to put this on high priority. It is most problematic for mobile users where they use back button most of the time.
by
Thanks for your confirmation Jatin. Appreciated!
by
Searched a bit and found this proposed "solution":

<?php session_cache_limiter('private_no_expire'); // must go before session start session_start(); ?>
For details, see http://php.net/manual/en/function.session-cache-limiter.php

Found here: https://support.mozilla.org/en-US/questions/922734?page=2

More possible solutions and info here: http://stackoverflow.com/questions/10795552/php-document-expired

Code for post-redirect-pattern:
if(isPosted()){
    if(dataIsValid($postedData)){
// dataIsValid should set $message to show to the user
        saveData($postedData);
        redirect('after.php');
        die();
    }
} else {
    $postedData = $defaultValues;
}
showForm($postedData, $message);

from http://stackoverflow.com/a/19188306/1066234

1 Answer

+1 vote
by
Just put in your main file this code

<?php header("Cache-Control: max-age=300, must-revalidate"); ?>

it solve it definatly
...