CentOS 7 のmod_expires
のmod_expires.conf
を
- mod_expires.conf 設定内容は
<IfModule expires_module> ExpiresActive On # static content ExpiresByType image/jpeg "access plus 1 months" ExpiresByType image/gif "access plus 1 months" ExpiresByType image/png "access plus 1 months" ExpiresByType text/css "access plus 1 months" ExpiresByType text/javascript "access plus 1 months" # Font ExpiresByType application/vnd.ms-fontobject "access plus 1 year" ExpiresByType application/x-font-ttf "access plus 1 year" ExpiresByType application/x-font-opentype "access plus 1 year" ExpiresByType application/x-font-woff "access plus 1 year" ExpiresByType image/svg+xml "access plus 1 year" ExpiresByType application/font-woff2 "access plus 1 year" ExpiresByType application/font-woff "access plus 1 year" ExpiresByType image/x-icon "access plus 1 year" ExpiresByType image/vnd.microsoft.icon "access plus 1 year" </IfModule>
CentOS 6 で 使用していた Apache の 設定です。
これで、javascript の Cache 有効期限は 1月に なると 思っていましたが、 有効期限が 設定されませんでした。
CentOS 6 と/etc/mime.types
には
** CentOS 7**
application/javascript js
** CentOS 6**
text/javascript js
JSのapplication/javascript
が
sonarwhal/sonarwhal: A linting tool for the web で‘content-type’ header should have media type ‘text/javascript’ (not ‘application/javascript’)
とtext/javascript
が
mod_expires.conf
に、
- 追加した
記述 ExpiresByType application/javascript "access plus 1 months"
以上です。
content-type と、
MIME Type は 似て非なる ものなんですね。 「MIME タイプ」と 「Content-type」の 違い| 「分かりそう」で 「分からない」でも 「分かった」 気に なれるIT用語辞典 ↩
コメント