Я пытаюсь включить кеширование браузера для моего приложения angular5. Файлы обслуживаются с помощью apache
Вот конфигурация, которую я добавил в vhost
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType application/javascript "access 1 week"
ExpiresDefault "access 1 month"
</IfModule>
<IfModule mod_headers.c>
<filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf)$">
Header set Cache-Control "max-age=2678400, public"
</filesmatch>
<filesmatch "\.(html|htm)$">
Header set Cache-Control "max-age=7200, private, must-revalidate"
</filesmatch>
<filesmatch "\.(pdf)$">
Header set Cache-Control "max-age=86400, public"
</filesmatch>
<filesmatch "\.(js)$">
Header set Cache-Control "max-age=2678400, private"
</filesmatch>
</IfModule>
Но я тестирую свой сайт с https://tools.pingdom.com/ Я получаю сообщение об ошибке кеширования для .js ,.css and .png
активы.
Следующие кэшируемые ресурсы имеют короткий срок действия. Укажите срок действия не менее одной недели в будущем для следующих ресурсов:
ОБНОВИТЬ
Заголовок для .js
HTTP/1.1 200 OK
Date: Fri, 17 Aug 2018 09:44:03 GMT
Server: Apache/2.4.18 (Ubuntu)
Last-Modified: Thu, 16 Aug 2018 11:25:11 GMT
ETag: "172da-5738bb238dfbb-gzip"
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: gzip
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Frame-Options: DENY
Strict-Transport-Security: max-age=631138519; includeSubDomains
Content-Length: 32241
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/javascript