Cache question

avalon-ua

Active member
My hoster uses Varnish Caching technology and told me to create mod_headers and mod_expires via it .htaccess file... Who knows how to manage with it?
 
Last edited:
I dont have much experience with varnish, but I guess you need something like:

Code:
<ifModule mod_headers.c>
  <filesMatch "\.(jpe?g|png|gif)$">
    Header set Cache-Control "public"
  </filesMatch>
  <filesMatch "\.(css)$">
    Header set Cache-Control "public"
  </filesMatch>
</ifModule>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 week"
ExpiresByType image/jpeg "access 1 week"
ExpiresByType image/gif "access 1 week"
ExpiresByType image/png "access 1 week"
ExpiresByType text/css "access 1 week"
</IfModule>
 
I dont have much experience with varnish, but I guess you need something like:

Code:
<ifModule mod_headers.c>
  <filesMatch "\.(jpe?g|png|gif)$">
    Header set Cache-Control "public"
  </filesMatch>
  <filesMatch "\.(css)$">
    Header set Cache-Control "public"
  </filesMatch>
</ifModule>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 week"
ExpiresByType image/jpeg "access 1 week"
ExpiresByType image/gif "access 1 week"
ExpiresByType image/png "access 1 week"
ExpiresByType text/css "access 1 week"
</IfModule>
Do I need to add this to it .htaccess file?
 
Top Bottom