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";
    }
相关推荐
fuyongliang12316 分钟前
nginx反向代理,负载均衡,tomcat的数据流向图篇解析
nginx·tomcat·负载均衡
tuokuac1 小时前
nginx配置前端请求转发到指定的后端ip
前端·tcp/ip·nginx
上官浩仁3 小时前
springboot redisson 缓存入门与实战
spring boot·redis·缓存
苹果醋35 小时前
数据库索引设计:在 MongoDB 中创建高效索引的策略
java·运维·spring boot·mysql·nginx
络76 小时前
Redis 非缓存核心场景及实例说明
数据库·redis·缓存
✎﹏赤子·墨筱晗♪6 小时前
从反向代理到负载均衡:Nginx + Tomcat 构建高可用Web服务架构
nginx·tomcat·负载均衡
叶绪2587 小时前
Nginx 反向代理 + Tomcat 集群:负载均衡配置步骤与核心原理
nginx·tomcat·负载均衡
土了个豆子的9 小时前
03.缓存池
开发语言·前端·缓存·visualstudio·c#
杏花春雨江南10 小时前
腾讯云 CLB (Cloud Load Balancer) 为例,详细讲解如何配置 Nginx 集群
nginx·云计算·腾讯云
YUELEI11810 小时前
langchain 缓存 Caching
缓存·langchain