Answer the question
In order to leave comments, you need to log in
How to set up Cache-Control in Symfony?
Specified cache lifetime in .htaccess
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType text/css "access plus 2592000 seconds"
ExpiresByType text/javascript "access plus 2592000 seconds"
ExpiresByType application/x-javascript "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
</IfModule>
$kernel = new AppCache($kernel);
Answer the question
In order to leave comments, you need to log in
I already figured out that the set directives in .htaccess did not work. I worked with admins for a long time, until I got to the bottom of it and explained what headers the static should return - nothing worked out for us.
Caching worked at the level of reading headers and, according to the ETag and Last-Modified properties, decides whether to read the file further or not. I asked to add more Cache-Control or Expires, they indicate how long the cache can be used without sending a request to the server, even to read the header.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question