Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Back Button behaviour after Post-Redirect-Get

My application disables caching on the browser via responses headers and then uses the Post-Redirect-Get pattern to enable the back button to "re-Get" the current page.
However on retesting this now with Firefox 12 and IE 8 I'm not seeing the results I was expecting (or that I had seen before with IE 6).

Upon selecting the back button I can see that the browser is attempting to perform the original request (the Post), not the redirected request (the Get). When I look at the requests on the network tab of Firebug I see the following:

Post-Redirect-Get

Looks like the browser is treating the Post and Get as the same request and hence selecting the back button is re-submitting the Post:

Result of Back Button

I am using JSF, but I think this is a browser issue. Does anyone know why the browser is not performing a get of the redirected page?

like image 517
Paul Avatar asked Oct 08 '22 16:10

Paul


1 Answers

It's working fine. The back button re-executes the request before "POST accountDetails.xhtml" which is not listed in your 1st screenshot, but is according the 2nd screenshot apparently (and logically) a "GET accountDetails.xhtml". You're apparently in the bean associated with that view or in some filter doing some checks and redirecting to "registrationWelcome.xhtml". The "POST accountDetails.xhtml" in the 1st screenshot is the current request which has been redirected to "reviewInfo.xhtml".

The back button does not re-execute the redirect. It's your own code which did it. The back button does also not re-execute the POST request, which is confirmed in the 2nd screenshot.

like image 134
BalusC Avatar answered Oct 13 '22 10:10

BalusC