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";
    }
相关推荐
似的8355 小时前
一步一步学习使用FireMonkey动画() 使用TAnimator类创建动画
linux·学习·nginx
梅孔立9 小时前
两种免费的翻译API调用方式详解 - Edge官方API与个人缓存服务
前端·缓存·edge
gwf2169 小时前
SSD读写速度深度解析:顺序读写vs随机读写、IOPS、延迟,你的硬盘性能到底怎么看?
git·嵌入式硬件·缓存·github·智能硬件
番茄炒鸡蛋加糖12 小时前
缓存三大问题
缓存
江晓鱼未暖17 小时前
十七、Redis 核心原理与架构详解
大数据·数据库·数据仓库·redis·缓存·架构
小罗水17 小时前
第13章 Redis 缓存、幂等锁与任务状态
数据库·redis·缓存
热心市民lcj17 小时前
Spring Boot 整合 Caffeine 本地缓存实战
spring boot·后端·缓存
zx11545019 小时前
【热点 Key 探测与加长缓存 TTL 实战】
缓存
闪亮的路灯1 天前
威联通QTS使用自带web服务期代理前端(类似nginx)
前端·nginx·威联通
toooooop81 天前
如何用 ss + ps 精准定位本机 Redis 的“隐形”消费者?
linux·数据库·redis·缓存