Force fresh load on browser history back using symfony [duplicate]

Force fresh load on browser history back using symfony [duplicate]

My situation is as follows:

  • You add a Product to your cart.
  • If you have not added an ExtraProduct, you get to see a page to add an ExtraProduct.
  • If you have added it and end up on the ExtraProductPage I redirect you one step forward.

The issue I’m having is that if a user presses ‘back’ in the browser, it loads the page from buffer (or at least it does in Firefox). Because the browser loads it from cache, my PHP never gets fired, so no redirect (which I do want).

The headers for this page:

Cache-Control max-age=0, must-revalidate, private, s-maxage=-1
Expires Wed, 15 Jan 2020 12:44:52 GMT (timestamp of the request)

Yet, it keeps buffering. I want to turn the buffering off for this specific route only. Any suggestions?
I can do some tinkering with javascript and a onready, but I prefer to keep it serverside. Thanks.

NOTE: MY question is not a duplicate of the linked one because I want a serverside, PHP symfony solution, not javascript.

Source: Symfony Questions

Leave a Reply

Your email address will not be published. Required fields are marked *