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.


1 Answer 1


If you look in


Line 85 onwards:

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

That may help. Good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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