【问题标题】:How to avoid response body on http 304 in nginx?如何避免 nginx 中 http 304 上的响应正文?
【发布时间】:2018-09-19 22:13:54
【问题描述】:

我正在使用 nginx 版本 1.10.3 向浏览器提供文件。 在我的服务器日志中,我看到了 304 响应的响应正文。如何避免?

Nginx 日志:

"GET /test/testfile.js HTTP/1.1" 304 2476 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"

因此,响应包含 chrome 中的 nginx 标头信息,这很奇怪。

{"testconf": "{"testfield":"1","testfield2":"2"}"}HTTP/1.1 
304 Not Modified
Server: nginx
Date: Sun, 15 Sep 2018 00:10:27 GMT
Last-Modified: Fri, 31 Aug 2018 00:49:38 GMT
Connection: keep-alive
ETag: "4b1190a2-1b642"
Last-Modified: Fri, 31 Aug 2018 00:49:38 GMT
Connection: keep-alive
Server: Test
X-Frame-Options: SAMEORIGIN
Cache-Control: public, max-age=0

{"testBooleanName":"true", "testLabelName":"label"}

【问题讨论】:

    标签: google-chrome nginx http-status-code-304 nginx-config


    【解决方案1】:

    我将我的 nginx 版本从 1.10.3 升级到 1.14.0,从而解决了这个问题。

    【讨论】:

      猜你喜欢
      • 2012-04-10
      • 1970-01-01
      • 2016-07-08
      • 2013-12-11
      • 1970-01-01
      • 2015-05-19
      • 2013-08-13
      • 2013-01-26
      相关资源
      最近更新 更多