文件时间与ERR_INVALID_HTTP_RESPONSE

起因

前端反馈说两套环境一套访问正常,一套访问无响应
登陆两台服务器检查发现

  • 两台机器的iptables和selinux都是关闭状态
  • 两台nginx的配置文件字节大小都是一致的,文件内容对比发现一致
  • 访问地址所指向的html文件字节大小和文件内容比对发现一致
  • nginx的日志文件输出正常,无报错,访问url也是200状态码
  • 浏览器F12选项也无异常,只是请求连接无响应

浏览器显示

排查

  • 两台机器都是我配置的,系统环境和软件环境都一致
    Nginx的配置文件,机器A B的配置一样,机器A访问无响应,机器B访问正常
server {
    # fe push static files at this folder
    listen 9911;
    server_name localhost;

    gzip on;
    #gzip_vary on;
    gzip_proxied any;
    gzip_disable "msie6";
    gzip_min_length 1k;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    #gzip_static on;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/bmp image/svg+xml image/jpeg image/x-icon;

    #FTP上传文件下载访问
    location / {
      alias /opt/public/file/;
      # autoindex on;
      add_header 'Access-Control-Allow-Origin' '*';
      add_header 'Access-Control-Allow-Credentials' 'true';
      add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
      add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
    }
  }
}

情况一

发现如果注释掉机器A的nginx跨域配置,发现可以访问html 但是不能传递参数

server {
    # fe push static files at this folder
    listen 9911;
    server_name localhost;

    gzip on;
    #gzip_vary on;
    gzip_proxied any;
    gzip_disable "msie6";
    gzip_min_length 1k;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    #gzip_static on;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/bmp image/svg+xml image/jpeg image/x-icon;

    #FTP上传文件下载访问
    location / {
      alias /opt/public/file/;
      # autoindex on;
      #add_header 'Access-Control-Allow-Origin' '*';
      #add_header 'Access-Control-Allow-Credentials' 'true';
      #add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
      #add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
    }
  }
}

问题解决

  • 经过层层排查 发现URL访问路径的静态页面和JS文件的Modify和Change时间是1929年,应该是测试或者开发人员本地电脑调整过时间 将文件上传到服务器
[root@VM_OUT_101 ~]# stat install.log
  File: "install.log"
  Size: 13231     	Blocks: 32         IO Block: 4096   普通文件
Device: fd00h/64768d	Inode: 392450      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-07-06 11:11:13.417000002 +0800
Modify: 1929-07-06 11:13:36.890999991 +0800
Change: 1929-07-06 11:13:39.479999991 +0800
  • 解决问题时没有截图,上面是我手动更改的时间
  • 而Linux系统最早支持时间是1970年,该文件的时间戳系统服务无法读取,导致无响应
  • 在时间正常的服务器上手动更改下文件,让文件的时间戳成为正常时间即可
已标记关键词 清除标记
<div><p>Sporadically I receive an <code>ERR_INVALID_HTTP_RESPONSE</code> error which prevents me from receiving data from a user's file. I've noticed this occurs mainly when I've just authenticated. I refresh a few times and the error goes away.</p> <pre><code> OPTIONS {<!-- -->{v1/stores route}} net::ERR_INVALID_HTTP_RESPONSE </code></pre> <p>This video demonstrates the bug: https://www.useloom.com/share/82c4799238f44e20a22463c8debde694</p> <p>Here is my <code>api_endpoint.log</code>: https://gist.github.com/cwackerfuss/dfc0bfcee0521a43067c325664bc8f77</p> <p>I spoke with and he suggested this may be network trouble based on the following code:</p> <pre><code> 127.0.0.1 - - [25/Nov/2017 23:31:34] "GET /v1/node/ping HTTP/1.1" 200 - 127.0.0.1 - - [25/Nov/2017 23:31:34] "GET /v1/wallet/payment_address HTTP/1.1" 200 - [2017-11-25 23:31:35,295] [DEBUG] [common:671] (38825) Fetched 1050 bytes [2017-11-25 23:31:35,297] [DEBUG] [common:657] (38825) Fetch index page https://www.dropbox.com/s/ccoh5anp92wska5/e?dl=1 via HTTP [2017-11-25 23:31:36,524] [DEBUG] [common:671] (38825) Fetched 182 bytes [2017-11-25 23:31:36,525] [ERROR] [common:981] (38825) No data URL from index for '/0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore' [2017-11-25 23:31:36,525] [ERROR] [common:1048] (38825) Failed to load data for /0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore from hologram.id when forcing cache misses [2017-11-25 23:31:36,525] [ERROR] [common:1059] (38825) Failed to load data for /0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore from hologram.id [2017-11-25 23:31:36,526] [DEBUG] [storage:932] (38918.123145497374720) No data from dropbox (https://www.dropbox.com/blockstack/0%253A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore) [2017-11-25 23:31:36,531] [ERROR] [data:937] (38918.123145497374720) Failed to get mutable datum 0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore from dropbox [2017-11-25 23:31:36,535] [DEBUG] [data:931] (38918.123145497374720) get_mutable_data(0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore) from s3 [2017-11-25 23:31:36,540] [DEBUG] [storage:873] (38918.123145497374720) get_mutable_data 0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore fqu=hologram.id bsk_version=2 [2017-11-25 23:31:36,544] [DEBUG] [storage:891] (38918.123145497374720) 0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore available at https://blockstack-server-profiles.s3.amazonaws.com/0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore [2017-11-25 23:31:36,549] [DEBUG] [storage:917] (38918.123145497374720) Try s3 (https://blockstack-server-profiles.s3.amazonaws.com/0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore) [2017-11-25 23:31:36,553] [DEBUG] [s3:88] (38825) Anonymous read-only connect to S3 [2017-11-25 23:31:37,560] [ERROR] [s3:92] (38825) Connection to S3 failed [2017-11-25 23:31:37,560] [ERROR] [s3:93] (38825) No handler was ready to authenticate. 1 handlers were checked. ['HmacAuthV1Handler'] Check your credentials Traceback (most recent call last): File "/tmp/blockstack-venv/lib/python2.7/site-packages/blockstack_client/backend/drivers/s3.py", line 90, in get_bucket conn = boto.connect_s3() File "/tmp/blockstack-venv/lib/python2.7/site-packages/boto/__init__.py", line 141, in connect_s3 return S3Connection(aws_access_key_id, aws_secret_access_key, **kwargs) File "/tmp/blockstack-venv/lib/python2.7/site-packages/boto/s3/connection.py", line 194, in __init__ validate_certs=validate_certs, profile_name=profile_name) File "/tmp/blockstack-venv/lib/python2.7/site-packages/boto/connection.py", line 569, in __init__ host, config, self.provider, self._required_auth_capability()) File "/tmp/blockstack-venv/lib/python2.7/site-packages/boto/auth.py", line 1021, in get_auth_handler 'Check your credentials' % (len(names), str(names))) NoAuthHandlerFound: No handler was ready to authenticate. 1 handlers were checked. ['HmacAuthV1Handler'] Check your credentials [2017-11-25 23:31:37,560] [ERROR] [s3:172] (38825) Failed to get bucket 'blockstack-server-profiles' [2017-11-25 23:31:37,561] [DEBUG] [storage:932] (38918.123145497374720) No data from s3 (https://blockstack-server-profiles.s3.amazonaws.com/0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore) [2017-11-25 23:31:37,568] [ERROR] [data:937] (38918.123145497374720) Failed to get mutable datum 0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore from s3 [2017-11-25 23:31:37,573] [DEBUG] [data:931] (38918.123145497374720) get_mutable_data(0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore) from blockstack_resolver [2017-11-25 23:31:37,577] [DEBUG] [storage:873] (38918.123145497374720) get_mutable_data 0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore fqu=hologram.id bsk_version=2 [2017-11-25 23:31:37,582] [DEBUG] [storage:891] (38918.123145497374720) 0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore available at https://blockstack.s3.amazonaws.com/0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore [2017-11-25 23:31:37,587] [DEBUG] [storage:917] (38918.123145497374720) Try blockstack_resolver (https://blockstack.s3.amazonaws.com/0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore) [2017-11-25 23:31:37,858] [DEBUG] [blockstack_resolver:87] (38825) GET https://blockstack.s3.amazonaws.com/hologram.id status code 403 [2017-11-25 23:31:37,858] [DEBUG] [storage:932] (38918.123145497374720) No data from blockstack_resolver (https://blockstack.s3.amazonaws.com/0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore) [2017-11-25 23:31:37,864] [ERROR] [data:937] (38918.123145497374720) Failed to get mutable datum 0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore from blockstack_resolver [2017-11-25 23:31:37,869] [DEBUG] [data:931] (38918.123145497374720) get_mutable_data(0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore) from http [2017-11-25 23:31:37,874] [DEBUG] [storage:873] (38918.123145497374720) get_mutable_data 0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore fqu=hologram.id bsk_version=2 [2017-11-25 23:31:37,878] [DEBUG] [storage:891] (38918.123145497374720) 0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore available at None [2017-11-25 23:31:37,883] [DEBUG] [storage:897] (38918.123145497374720) Cannot use http to generate a URL for 0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore [2017-11-25 23:31:37,887] [ERROR] [data:937] (38918.123145497374720) Failed to get mutable datum 0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore from http [2017-11-25 23:31:37,891] [DEBUG] [data:931] (38918.123145497374720) get_mutable_data(0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore) from dht [2017-11-25 23:31:37,896] [DEBUG] [storage:873] (38918.123145497374720) get_mutable_data 0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore fqu=hologram.id bsk_version=2 [2017-11-25 23:31:37,902] [DEBUG] [storage:891] (38918.123145497374720) 0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore available at dht+udp://40ad6ff12b4e32b4615e78bb2f28e46931953600 [2017-11-25 23:31:37,907] [DEBUG] [storage:917] (38918.123145497374720) Try dht (dht+udp://40ad6ff12b4e32b4615e78bb2f28e46931953600) [2017-11-25 23:31:38,006] [DEBUG] [storage:932] (38918.123145497374720) No data from dht (dht+udp://40ad6ff12b4e32b4615e78bb2f28e46931953600) [2017-11-25 23:31:38,013] [ERROR] [data:937] (38918.123145497374720) Failed to get mutable datum 0%3A1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka.datastore from dht [2017-11-25 23:31:38,026] [DEBUG] [data:235] (38918.123145497374720) Cache datastore 1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka 127.0.0.1 - - [25/Nov/2017 23:31:38] "GET /v1/stores/1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka?device_ids=0&blockchain_id=hologram.id HTTP/1.1" 200 - [2017-11-25 23:31:38,031] [ERROR] [rpc:4005] (38918.123145497374720) [Errno 41] Protocol wrong type for socket Traceback (most recent call last): File "/tmp/blockstack-venv/lib/python2.7/site-packages/blockstack_client/rpc.py", line 4002, in _dispatch return route_method( session, path_info, *route_args ) File "/tmp/blockstack-venv/lib/python2.7/site-packages/blockstack_client/rpc.py", line 1318, in GET_store return self._reply_json(ret) File "/tmp/blockstack-venv/lib/python2.7/site-packages/blockstack_client/rpc.py", line 231, in _reply_json self._send_headers(status_code=status_code) File "/tmp/blockstack-venv/lib/python2.7/site-packages/blockstack_client/rpc.py", line 219, in _send_headers self.send_header('content-type', content_type) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 401, in send_header self.wfile.write("%s: %s\r\n" % (keyword, value)) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 328, in write self.flush() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 307, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) error: [Errno 41] Protocol wrong type for socket 127.0.0.1 - - [25/Nov/2017 23:31:38] "GET /v1/stores/1PtxJPxdzkeJ3hmTqKZo2ejiZbNbL5Loka?device_ids=0&blockchain_id=hologram.id HTTP/1.1" 500 - Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 599, in process_request_thread self.finish_request(request, client_address) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 334, in finish_request self.RequestHandlerClass(request, client_address, self) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 657, in __init__ self.finish() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 716, in finish self.wfile.close() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 283, in close self.flush() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 307, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) error: [Errno 32] Broken pipe [2017-11-25 23:31:57,509] [DEBUG] [rpc:3923] (38918.123145522614272) full path: /v1/wallet/payment_address method: OPTIONS path: /v1/wallet/payment_address qs: {} headers: origin: http://localhost:8888 accept-language: en-US,en;q=0.9 accept-encoding: gzip, deflate, br access-control-request-headers: authorization,content-type connection: keep-alive accept: */* user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36 access-control-request-method: GET host: localhost:6270 referer: http://localhost:8888/auth?authRequest=eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.eyJqdGkiOiIyOTMyOTliMy0zZGZkLTRmNjktOWJiMy02ODgxMTc5NDI0YjgiLCJpYXQiOjE1MTE2NzQzMTYsImV4cCI6MTUxMTY3NzkxNiwiaXNzIjoiZGlkOmJ0Yy1hZGRyOjFDR2dUaFMzb1EyYW03VFBSWThTVm1FaVRXUnpNVkZWSmYiLCJwdWJsaWNfa2V5cyI6WyIwMzQxM2Y5M2M0OTZkNjg3MmNkZWNlZDAzMmExMzkyNmJlNDgzMDMwZGZjMTM4YTA0OTY0MmNhZGExODIwZDUzZTkiXSwiZG9tYWluX25hbWUiOiJodHRwOi8vbG9jYWxob3N0OjMwMDAiLCJtYW5pZmVzdF91cmkiOiJodHRwOi8vbG9jYWxob3N0OjMwMDAvbWFuaWZlc3QuanNvbiIsInJlZGlyZWN0X3VyaSI6Imh0dHA6Ly9sb2NhbGhvc3Q6MzAwMC8iLCJzY29wZXMiOlsic3RvcmVfd3JpdGUiXX0.EghFuYF4NZpIHRW2RWCjjL8f8w34zA_3aGx1UedjDbQU5c_CAp94iBbCcsz6sxq-plrLGJfXZRyAOxmJ6idxYQ [2017-11-25 23:31:57,510] [DEBUG] [rpc:3923] (38918.123145526820864) full path: /v1/node/ping method: GET path: /v1/node/ping qs: {} headers: origin: http://localhost:8888 accept-language: en-US,en;q=0.9 accept-encoding: gzip, deflate, br connection: keep-alive accept: */* user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36 host: localhost:6270 referer: http://localhost:8888/auth?authRequest=eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.eyJqdGkiOiIyOTMyOTliMy0zZGZkLTRmNjktOWJiMy02ODgxMTc5NDI0YjgiLCJpYXQiOjE1MTE2NzQzMTYsImV4cCI6MTUxMTY3NzkxNiwiaXNzIjoiZGlkOmJ0Yy1hZGRyOjFDR2dUaFMzb1EyYW03VFBSWThTVm1FaVRXUnpNVkZWSmYiLCJwdWJsaWNfa2V5cyI6WyIwMzQxM2Y5M2M0OTZkNjg3MmNkZWNlZDAzMmExMzkyNmJlNDgzMDMwZGZjMTM4YTA0OTY0MmNhZGExODIwZDUzZTkiXSwiZG9tYWluX25hbWUiOiJodHRwOi8vbG9jYWxob3N0OjMwMDAiLCJtYW5pZmVzdF91cmkiOiJodHRwOi8vbG9jYWxob3N0OjMwMDAvbWFuaWZlc3QuanNvbiIsInJlZGlyZWN0X3VyaSI6Imh0dHA6Ly9sb2NhbGhvc3Q6MzAwMC8iLCJzY29wZXMiOlsic3RvcmVfd3JpdGUiXX0.EghFuYF4NZpIHRW2RWCjjL8f8w34zA_3aGx1UedjDbQU5c_CAp94iBbCcsz6sxq-plrLGJfXZRyAOxmJ6idxYQ [2017-11-25 23:31:57,517] [DEBUG] [rpc:390] (38918.123145522614272) No authorization header [2017-11-25 23:31:57,522] [DEBUG] [rpc:390] (38918.123145526820864) No authorization header [2017-11-25 23:31:57,527] [DEBUG] [rpc:3965] (38918.123145522614272) No authentication needed [2017-11-25 23:31:57,532] [DEBUG] [rpc:3965] (38918.123145526820864) No authentication needed 127.0.0.1 - - [25/Nov/2017 23:31:57] "OPTIONS /v1/wallet/payment_address HTTP/1.1" 200 - 127.0.0.1 - - [25/Nov/2017 23:31:57] "GET /v1/node/ping HTTP/1.1" 200 - [2017-11-25 23:31:57,542] [ERROR] [rpc:4005] (38918.123145526820864) [Errno 32] Broken pipe Traceback (most recent call last): File "/tmp/blockstack-venv/lib/python2.7/site-packages/blockstack_client/rpc.py", line 4002, in _dispatch return route_method( session, path_info, *route_args ) File "/tmp/blockstack-venv/lib/python2.7/site-packages/blockstack_client/rpc.py", line 2981, in GET_ping self._reply_json({'status': 'alive', 'version': SERIES_VERSION}) File "/tmp/blockstack-venv/lib/python2.7/site-packages/blockstack_client/rpc.py", line 231, in _reply_json self._send_headers(status_code=status_code) File "/tmp/blockstack-venv/lib/python2.7/site-packages/blockstack_client/rpc.py", line 218, in _send_headers self.send_response(status_code) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 393, in send_response (self.protocol_version, code, message)) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 328, in write self.flush() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 307, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) error: [Errno 32] Broken pipe 127.0.0.1 - - [25/Nov/2017 23:31:57] "GET /v1/node/ping HTTP/1.1" 500 - Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 599, in process_request_thread self.finish_request(request, client_address) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 334, in finish_request self.RequestHandlerClass(request, client_address, self) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 657, in __init__ self.finish() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 716, in finish self.wfile.close() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 283, in close self.flush() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 307, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) error: [Errno 32] Broken pipe [2017-11-25 23:31:57,653] [DEBUG] [rpc:3923] (38918.123145522614272) full path: /v1/wallet/payment_address </code></pre> <p>Any help would be appreciated!</p><p>该提问来源于开源项目:blockstack/stacks-blockchain</p></div>
©️2020 CSDN 皮肤主题: 游动-白 设计师:白松林 返回首页