Nginx缓存已过期,命中请求的响应大小相差5字节

Nginx缓存已过期,命中请求的响应大小相差5字节,nginx,caching,Nginx,Caching,我试图确定nginx缓存命中与过期时的响应内容长度差异。命中时,我得到2070字节,而未命中/过期时,我在访问日志中得到2075字节,其中我已打印$body\u bytes\u sent 我使用gzip编码和Tomcat作为nginx背后的服务器 HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty("Accept", "*/*");

我试图确定nginx缓存命中与过期时的响应内容长度差异。命中时,我得到2070字节,而未命中/过期时,我在访问日志中得到2075字节,其中我已打印$body\u bytes\u sent

我使用gzip编码和Tomcat作为nginx背后的服务器

      HttpURLConnection conn = (HttpURLConnection) url.openConnection();
      conn.setRequestProperty("Accept", "*/*");
      conn.setRequestProperty("Cache-Control", "no-cache");
      conn.setRequestProperty("Connection", "keep-alive");
      conn.setRequestProperty("Host", "172.30.9.44");
      conn.setRequestProperty("Postman-Token", "bafd1fda-7aca-4757-aef8-b2a78ff8ea02,5149660d-3505-4df4-b743-6e3d48daffa5");
      conn.setRequestProperty("User-Agent", "PostmanRuntime/7.13.0");
      conn.setRequestProperty("cache-control", "no-cache");
      conn.setRequestProperty("accept-encoding", "gzip, deflate");
标头:{Transfer Encoding=[chunked],null=[HTTP/1.1200 OK],X-Cache-Status=[MISS],Server=[nginx/1.14.0],X-Request-Id=[4946d04e-b3ce-4868-b822-99aee71ea275],X-Served-By=[xxserverxx],内容编码=[gzip],连接=[keep-alive],Vary=[Accept-Encoding],日期=[Thu,2019年6月06日09:02:44 GMT],内容类型=[application/json;charset=UTF-8]}

标头:{Transfer Encoding=[chunked],null=[HTTP/1.1200 OK],X-Cache-Status=[HIT],Server=[nginx/1.14.0],X-Request-Id=[d36ae47c-a7a6-4c82-98e2-69f5ccf110f6],X-Served-By=[xxserverxx],内容编码=[gzip],连接=[keep-alive],Vary=[Accept-Encoding],日期=[Thu,2019年6月6日10:19 GMT],内容类型=[application/json;charset=UTF-8]}