超时请求,但Cloudflare请求200

时间:2017-02-21 14:11:49

标签: nginx okhttp cloudflare

我们遇到Cloudflare的超时请求问题。请参阅以下示例:

  1. OkHttp 3.6 + Retrofit 2.1 + Android + HTTPS + HTTP / 2
  2. 创建一个OkHttp客户端
  3. GET(或POST)请求(循环,与请求之间的1秒同步)
  4. 设备日志

    GET test?id=0 200
    GET test?id=1 200
    GET test?id=2 200
    

    nginx日志

    GET test?id=0 200
    GET test?id=1 200
    GET test?id=2 200
    
    1. 关闭网络(我们断开电缆,但设备仍然连接到路由器)
    2. 等等。 30-60秒
    3. 设备日志

      GET test?id=3 timeout
      GET test?id=4 timeout
      GET test?id=5 timeout
      GET test?id=6 timeout
      GET test?id=7 timeout
      GET test?id=8 timeout
      GET test?id=9 timeout
      GET test?id=10 timeout
      
      1. 恢复网络
      2. 第一种情况(使用cloudflare从我们的nginx登录)

        [21/Feb/2017:13:45:49 +0000] "GET test?id=7 HTTP/2" 200 44
        [21/Feb/2017:13:45:49 +0000] "GET test?id=16 HTTP/2" 200 44
        [21/Feb/2017:13:45:49 +0000] "GET test?id=5 HTTP/2" 200 44
        [21/Feb/2017:13:45:49 +0000] "GET test?id=4 HTTP/2" 200 44
        [21/Feb/2017:13:45:49 +0000] "GET test?id=6 HTTP/2" 200 44
        [21/Feb/2017:13:45:49 +0000] "GET test?id=8 HTTP/2" 200 44
        [21/Feb/2017:13:45:49 +0000] "GET test?id=14 HTTP/2" 200 44
        [21/Feb/2017:13:45:49 +0000] "GET test?id=10 HTTP/2" 200 44
        [21/Feb/2017:13:45:49 +0000] "GET test?id=9 HTTP/2" 200 44
        

        第二种情况(从没有cloudflare的nginx登录)

        [21/Feb/2017:13:45:49 +0000] "GET test?id=3 HTTP/1.1" 499 0
        [21/Feb/2017:13:45:49 +0000] "GET test?id=4 HTTP/1.1" 499 0
        [21/Feb/2017:13:45:49 +0000] "GET test?id=5 HTTP/1.1" 499 0
        [21/Feb/2017:13:45:49 +0000] "GET test?id=6 HTTP/1.1" 200 0
        [21/Feb/2017:13:45:49 +0000] "GET test?id=7 HTTP/1.1" 499 0
        [21/Feb/2017:13:45:49 +0000] "GET test?id=8 HTTP/1.1" 499 0
        [21/Feb/2017:13:45:49 +0000] "GET test?id=9 HTTP/1.1" 499 0
        [21/Feb/2017:13:45:49 +0000] "GET test?id=10 HTTP/1.1" 499 0
        [21/Feb/2017:13:45:49 +0000] "GET test?id=11 HTTP/1.1" 499 0
        

        3到11的请求在设备上超时,那么为什么我们在使用Cloudflare时会获得200个请求?如果我们直接向我们的服务器发出这些请求(没有Cloudflare),我们会按预期得到499。

0 个答案:

没有答案
相关问题