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";
    }
相关推荐
水冗水孚1 小时前
图文并茂讲解nginx中http升级https(部署SSL证书)知识点总结
nginx·http·https
如白驹过隙15 小时前
cloudflare缓存配置
前端·缓存
HYI17 小时前
小公司前端多分支测试太痛苦?我自己写了个轻量 CLI
nginx·vite
海梨花21 小时前
【从零开始学习Redis】项目实战-黑马点评D2
java·数据库·redis·后端·缓存
timeweaver21 小时前
深度解析 Nginx 前端 location 配置与优先级:你真的用对了吗?
前端·nginx·前端工程化
Moment1 天前
nginx 如何配置防止慢速攻击 🤔🤔🤔
前端·后端·nginx
伊成2 天前
Docker 部署 Nginx 完整指南
nginx·docker·容器
2301_793086872 天前
Redis 04 Reactor
数据库·redis·缓存
189228048612 天前
NY243NY253美光固态闪存NY257NY260
大数据·网络·人工智能·缓存
青鱼入云2 天前
redis怎么做rehash的
redis·缓存