• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Cache question

avalon-ua

Active member
#1
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:

Slavik

XenForo moderator
Staff member
#2
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>
 

avalon-ua

Active member
#3
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?