这是我要工作的内容:
Cache-Control: max-age=29030400, public
Expires: Wed, 30 Dec 2015 18:00:00 GMT
理论上,您只需要其中一个。但是整个浏览器缓存与 S3 和 CloudFront 的关系一直让我感到很痛苦,所以我喜欢将它们都保留在那里。我还将以下内容放入我的.htaccess
文件中:
# BEGIN Caching
Header set Cache-Control "max-age=29030400, public"
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType text/plain "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType application/x-icon "access plus 1 year"
</IfModule>
# END Caching