2341 发表于 2016-1-11 08:25:55

apache用户认证和静态缓存疑惑

apache配置用户认证后
      <Directory /data/www/abc>
                AllowOverride AuthConfig
                AuthName "z"
                AuthType Basic
                AuthUserFile /data/.htpasswd
                require valid-user
      </Directory>
第一次访问需要认证,然后清除浏览器缓存,第二次在访问该目录时,不需要认证。可是已经清除缓存了,为什么不需要认证就可以访问文件呢?


apache配置静态缓存后
      <IfModule mod_expires.c>
                ExpiresActive on
                ExpiresByType image/gif "access plus 1 days"
                ExpiresByType image/jpeg "access plus 24 hours"
                ExpiresByType image/png "access plus 1 min"
                ExpiresByType text/css "now plus 2 hour"
                ExpiresByType application/x-javascript "now plus 2 hours"
                ExpiresByType application/javascript "now plus 2 hours"
                ExpiresByType application/x-shockwave-flash "now plus 2 hours"
                ExpiresDefault "now plus 0 min"
      </IfModule>
对于png图片的缓存是一分钟,在浏览器上输入图片地址,第一次是返回200 OK,然后过一分钟后,再次访问该图片,返回是304。(Cache-Control: max-age的值是60)可是静态文件缓存时间不是一分钟吗?应该一分钟后缓存自动删除,再次访问应该也是200OK,为什么是304呢?



页: [1]
查看完整版本: apache用户认证和静态缓存疑惑