【发布时间】:2019-06-05 18:29:19
【问题描述】:
我使用 nginx 作为反向代理来连接 api。问题是当我在添加或删除某些内容后发送查询时。 Nginx 将旧的 json 值发送给我。我试图禁用缓存,但它不起作用。
我的 nginx 配置:
location / {
sendfile off;
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
proxy_no_cache 1;
proxy_cache_bypass 1;
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header HTTPS $https;
}
我尝试了不使用 nginx 的查询,并且在控制台中一切正常
谢谢!
【问题讨论】:
-
后端应用缓存了吗?
-
不,当我在控制台服务器中查询时。它一直在发送好的 json
-
最后,这是我的后端......我在关闭数据库中的会话时犯了一些错误。
标签: nginx nginx-reverse-proxy no-cache