如何防止“304未修改”在nginx中? [英] How to prevent "304 Not Modified" in nginx?

查看:1926
本文介绍了如何防止“304未修改”在nginx中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图禁用nginx中的所有缓存作为测试目的。



我已经设置了以下行

  add_header Cache-Control no-cache; 

我发现页面本身没有被缓存,但是图片,css和javascripts都是。我怀疑这是因为Firefox收到304 Not Modified标题。



有没有办法阻止它?



PS:



我想我自己找到了。 Firefox现在一直显示'200 OK'。

这是正确的吗?



我已经加入

  if_modified_since off; 
add_header Last-Modified;


解决方案

听起来正确。



如果代理(本例中为Firefox)表示200 OK,则表示发生了转移。


I'm trying to disable all the caches in nginx for testing purpose.

I've set the following line

add_header Cache-Control no-cache;

I see that the page itself is not cached, but the images, css, and javascripts are. I suspect that this is because Firefox is getting "304 Not Modified" header.

Is there a way to prevent it?

P.S:

I think I found it myself. Firefox shows '200 OK' all the time now.

Is this correct way?

I've added

if_modified_since off;
add_header Last-Modified "";

解决方案

Sounds right to me.

If the agent (in this case Firefox) says 200 OK, it means the transfer happened.

这篇关于如何防止“304未修改”在nginx中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆