With the example to create a default controller and add the [ResponseCache attribute to decorate it... There is an extra step not mentioned in the example, which is to tell umbraco to use your default controller for all requests...
The 'Cache-Control' and 'Pragma' headers have been overridden and set to 'no-cache, no-store' and 'no-cache' respectively to prevent caching of this response. Any response that uses antiforgery should not be cached.
Turned out I had a contactfom on the page using BeginUmbracoForm.
Since the form doesn't send anything to the database, but send maills only, I figure I can set the AntiForgeryToken to false. Then my page is cached :-)
Cannot get Response Caching to work
I'm usin an Umbraco version 12.3.3 installation, and I'm trying to get Response Caching to work acording this tutorial: https://docs.umbraco.com/umbraco-cms/reference/response-caching
No matter what I do I cannot get 'Cache-Control' to show anything else.
I even tried to set my response header directly in my RenderController:
with no luck either... - I geting to think it's some kind of setting I'm not aware of... - plz help :-|
Hi Robin
With the example to create a default controller and add the [ResponseCache attribute to decorate it... There is an extra step not mentioned in the example, which is to tell umbraco to use your default controller for all requests...
https://docs.umbraco.com/umbraco-cms/implementation/default-routing/controller-selection#change-the-default-controllers
Anyway it may be something else at issue, but thought I'd mention in case that is the bit your missing..
Regards
Marc
From the log:
Turned out I had a contactfom on the page using BeginUmbracoForm.
Since the form doesn't send anything to the database, but send maills only, I figure I can set the AntiForgeryToken to false. Then my page is cached :-)
https://our.umbraco.com/forum/umbraco-forms/88247-antiforgerytoken-and-page-cache
Aha!
Glad you got to the bottom of it, yes, a form with antiforgery shouldn't be cached!
regards
Marc
is working on a reply...