nginx配置不缓存资源

方法1

conf 复制代码
        location / {
            index  index.html index.htm;
            add_header Cache-Control no-cache,no-store;
            try_files $uri $uri/ /index.html;
            #include mime.types;
            if ($request_filename ~* .*\.(htm|html)$) 
            {
              add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
            }
        }

方法2

conf 复制代码
        location / {
            index  index.html index.htm;
            add_header Cache-Control no-cache,no-store;
            try_files $uri $uri/ /index.html;
            #include mime.types;
            #if ($request_filename ~* .*\.(htm|html)$) 
            #{
            #  add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
           # }
        }
       location = /index.html {
            #add_header Cache-Control "no-cache, no-store, must-revalidate";
            add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
            add_header Pragma "no-cache";
            add_header Expires "0";
    }
相关推荐
逆袭的菜鸟X1 小时前
极简HTTP缓存类封装
缓存
@淡 定4 小时前
Redis持久化机制
数据库·redis·缓存
苹果醋35 小时前
iview— Select— Option选中后有空格
运维·vue.js·spring boot·nginx·课程设计
2501_941148155 小时前
从边缘节点到云端协同的分布式缓存一致性实现原理实践解析与多语言代码示例分享笔记集录稿
笔记·分布式·物联网·缓存
@淡 定6 小时前
主流缓存中间件对比:Redis vs Memcached
redis·缓存·中间件
阿佳举世无双6 小时前
快速启动redis
数据库·redis·缓存
星辰_mya7 小时前
redis主从同步-概览
数据库·redis·缓存
catoop8 小时前
网站安全加固:优化 Nginx 安全头配置
nginx·安全
写代码的小阿帆10 小时前
Java本地缓存技术——Guava、Caffeine
java·缓存·guava
我爱娃哈哈11 小时前
告别Redis瓶颈:Caffeine本地缓存优化实战指南
数据库·redis·缓存