Home>

Thanks for your attention.
We are verifying the speeding up of the website.
I looked at the article about speeding up by various searches and tried setting the browser cache, but the image etc. is `` Cache-Control: no-cache '' in the browser cache and it seems that it is not activated .

htaccess has the following settings.

# gzip compression
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \. (?: gif | jpe? G | png | ico) $no-gzip dont-vary
Header append Vary Accept-Encoding env =! Dont-vary
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE image/svg + xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml + xml
AddOutputFilterByType DEFLATE application/rss + xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-font-woff
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
</IfModule>
# Set browser cache
<IfModule mod_headers.c>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 weeks"
ExpiresByType text/css "access plus 1 weeks"
ExpiresByType text/javascript "access plus 1 weeks"
ExpiresByType image/gif "access plus 1 weeks"
ExpiresByType image/jpeg "access plus 1 weeks"
ExpiresByType image/png "access plus 1 weeks"
ExpiresByType image/svg + xml "access plus 1 weeks"
ExpiresByType application/pdf "access plus 1 weeks"
ExpiresByType application/javascript "access plus 1 weeks"
ExpiresByType application/x-javascript "access plus 1 weeks"
ExpiresByType application/x-shockwave-flash "access plus 1 weeks"
ExpiresByType application/x-font-ttf "access plus 1 weeks"
ExpiresByType application/x-font-woff "access plus 1 weeks"
ExpiresByType application/x-font-opentype "access plus 1 weeks"
ExpiresByType application/vnd.ms-fontobject "access plus 1 weeks"
Header unset ETag
</IfModule>
</IfModule>
FileETag None


In httpd.conf
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
Has confirmed that is enabled.
I confirmed that gzip compression of mod_deflate is enabled
Browser cache does not work.
I don't know if the setting is wrong or if the validation is not enough.

If i know any problems or solutions, can you teach me?
Thanks for your consideration.

  • Answer # 1

    As far as we can guess from the state described, the description in mod_expires.c seems to work.
    The only parts of interest are the following: Is there a purpose between mod_headers.c? I thought it would work just by taking it.

    <IfModule mod_headers.c>
    <IfModule mod_expires.c>

    If it is considered to change the header information because it changes the cache value, mod_expires controls the setting of the server response Expires HTTP header and Cache-Control header max-age directive I think it is unnecessary.
    https://httpd.apache.org/docs/2.4/en/mod/mod_expires.html