Browse Source

资源文件使用缓存

yawyd313 1 month ago
parent
commit
afab9cf38c
2 changed files with 2 additions and 2 deletions
  1. BIN
      ob-proxy/nginx/conf.d/.obf.conf.swp
  2. 2 2
      ob-proxy/nginx/conf.d/obf.conf

BIN
ob-proxy/nginx/conf.d/.obf.conf.swp


+ 2 - 2
ob-proxy/nginx/conf.d/obf.conf

@@ -5,10 +5,10 @@ server {
     location / {
         if ($request_uri ~* .*[.](js|css|map|jpg|png|svg|ico)$) {
             # 除非浏览器选择禁用缓存,否则在max-age区间内,不会重新发起请求,即使服务器上的数据已经变化
-            # add_header Cache-Control "public, max-age=2592000";
+            add_header Cache-Control "public, max-age=2592000";
             # 浏览器依然会缓存,只是浏览器在使用缓存前需要向服务端确认缓存是否有效(请求头携带If-None-Match, If-Modified-Since),有效则304, 否则返回最新数据;
             # 如果浏览器选择禁用缓存(请求头中带Cache-Control: no-cache, 服务器会返回最新数据)
-            add_header Cache-Control "no-cache";
+            # add_header Cache-Control "no-cache";
         }
 
         root   /usr/share/nginx/html;