I needed to set Cache-Control to be enabled for mobile caching in an app.
Problem was no matter what I put in the .htaccess the response header did not change. It stayed as
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
I tried disabling nginx in plesk and the result was the following:
Cache-Control:max-age=2628000, public
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
the .htaccess code that I put in there:
Header set Cache-Control "max-age=2628000, public"
2
Answers
The problem here is that the CMS I used (Processwire) set Cache-Control to no cache automatically.
I simply added
on pages I want Cache-Control to fully follow my .htaccess
You have two “Cache-Control” headers in response:
It means that you have second definition of “Cache-Control” header , it can be in global apache configs, in VirtualServer of your domain, in another .htaccess.
Also back-end application(PHP) and front-end(JavaScript) can add this header.