Http标头未更新

时间:2019-05-26 16:27:02

标签: .htaccess http-headers amazon-elb

我有两个EC2服务器坐在一个AWS经典负载均衡器上。我正在尝试更新http标头,但更改未通过。目前头文件没有缓存,我想为图像/ css设置缓存。我已将所有指令放置在htaccess文件中,但标头未更新gettimg。

如果我在没有ELB的情况下访问服务器,则标头会使用我在htaccess文件中设置的值进行更新,因此ELB不会更新标头。

关于如何实现此目标的任何建议。


    ExpiresActive on
    ExpiresDefault "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType text/html "access plus 3 days"
    ExpiresByType text/xml "access plus 1 seconds"
    ExpiresByType text/plain "access plus 1 seconds"
    ExpiresByType application/xml "access plus 1 seconds"
    ExpiresByType application/rss+xml "access plus 1 seconds"
    ExpiresByType application/json "access plus 1 seconds"
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType text/javascript "access plus 1 week"
    ExpiresByType application/javascript "access plus 1 week"
    ExpiresByType application/x-javascript "access plus 1 week"
    ExpiresByType image/x-ico "access plus 1 year"
    ExpiresByType image/x-icon "access plus 1 year"
    ExpiresByType application/pdf "access plus 1 month"
    ExpiresByType video/mp4 "access plus 1 month"

    
    Header unset ETag
    Header unset Pragma
    Header unset Cache-Control
    Header unset Last-Modified
    Header append Cache-Control "max-age=604800, public"
    #Header set Last-modified "Sun, 26 May 2019 10:10:10 GMT"
    

0 个答案:

没有答案