Nginx缓存EXPIRED和HIT请求的响应大小相差5个字节

时间:2019-06-06 10:21:56

标签: nginx caching

我正在尝试确定Nginx缓存HIT与EXPIRED之间的响应内容长度差异。在命中时,我得到2070字节,而在未命中/意外事件中,我在访问日志中得到2075字节,其中我已打印$ body_bytes_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.1 200 OK],X-Cache-Status = [MISS],Server = [nginx / 1.14.0],X-Request-Id = [4946d04e-b3ce-4868-b822-99aee71ea275],X-Served-By = [xxserverxx],Content-Encoding = [gzip],Connection = [keep-alive],Vary = [Accept-Encoding],Date = [Thu ,2019年6月6日09:02:44 GMT],Content-Type = [application / json; charset = UTF-8]}

标头:{Transfer-Encoding = [chunked],null = [HTTP / 1.1 200 OK],X-Cache-Status = [HIT],Server = [nginx / 1.14.0],X-Request-Id = [d36ae47c-a7a6-4c82-98e2-69f5ccf110f6],X-Served-By = [xxserverxx],Content-Encoding = [gzip],Connection = [keep-alive],Vary = [Accept-Encoding],Date = [Thu ,2019年6月6日10:19:19 GMT],Content-Type = [application / json; charset = UTF-8]}

0 个答案:

没有答案