0

I have read in Magento 2 Dev Docs for Public content we can set no-cache HTTP headers for Controllers that don’t use layouts(last line in page).

Controllers that don’t use layouts should set no-cache HTTP headers.

I have a controller which use data from session object and when we enable FPC it doesn't work.

So I'm thinking to set no-cache HTTP headers for that controller may get data from the session object.

Let me know if I'm wrong somewhere.

Thanks

2

If you look in

vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor

Line 85 onwards:

$response = $this->_responseFactory->create();
$response->setRedirect($redirectUrl, $redirectCode);
$response->setNoCacheHeaders();
return $response;

That may help. Good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.