I'm doing it:
domain.com/route-name/?do-something=1
.. which sets a cookie and then redirects it using a 302 redirect:
domain.com/route-name/
It allows you to perform an action regardless of page view (cookie saves settings for the user).
I use Symfony2 reverse proxy by default, and everything is fine, but I need to prevent both of these requests from being cached.
I use this to do the redirection:
// $event being a listener, usually a request listener $response = new RedirectResponse($url, 302); $this->event->setResponse($response);
I tried things like this, but nothing works:
$response->setCache(array('max_age' => 0)); header("Cache-Control: no-cache");
So how do I stop caching these pages?
source share