Apache服务器,两个缓存控制max-age值

时间:2016-10-04 22:33:48

标签: apache .htaccess caching

我正在尝试使用Apache服务器为在Ubuntu 16.04上运行的站点设置缓存控制。这是该网站的.htaccess文件:

## EXPIRES CACHING ##
<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 application/pdf "access 1 month"
    ExpiresByType application/javascript "access 1 month"
    ExpiresByType application/x-javascript "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    Options +FollowSymLinks
    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

检查Chrome开发工具中的图片标题时,我会看到两个max-age值:

Cache-Control:max-age=60, public, max-age=31536000
Content-Type:image/jpeg

似乎第一个值覆盖了第二个值,因为我的网站上的资源没有被缓存超过一分钟。 60的第一个值定义在哪里?

0 个答案:

没有答案