I am trying to enable browser leverage caching for my angular5 application. Files serve with apache
Here is the configuration I've added in the 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>
But I am testing my website with https://tools.pingdom.com/ I am getting cache failed error message for the .js ,.css and .png
assets.
The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:
UPDATE
Header for .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