带有OPTIONS请求的net :: ERR_INCOMPLETE_CHUNKED_ENCODING

时间:2016-05-13 08:19:46

标签: php google-chrome nginx http-post http-options-method

我正在使用nginx(1.9.3)+ php-fpm(通过unix套接字)和另一个nginx作为反向代理。很少(约100个请求中的1个)我在target_link_libraries(MyStaticLib PUBLIC "$<$<CXX_COMPILER_ID:MSVC>:-SAFESEH:NO>") XHR请求期间从一个子域到另一个子域(cloud.example.com到api.example.com)获得net::ERR_INCOMPLETE_CHUNKED_ENCODING。在POST之前自动发送此OPTIONS请求。 Chrome版本50.0.2661.94(64位)OS X

反向代理:

OPTIONS

请求标题:

location / {
  proxy_pass http://xxx.xxx.xxx.xxx:80;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection $connection_upgrade;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_redirect off;
  proxy_buffering off;
}

回复标题:

  OPTIONS /my/request/uri HTTP/1.1
  Host: api.example.com
  Connection: keep-alive
  Access-Control-Request-Method: POST
  Origin: https://subdomain.example.com
  User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36
  Access-Control-Request-Headers: accept, content-type
  Accept: */*
  Referer: https://subdomain.example.com/
  Accept-Encoding: gzip, deflate, sdch
  Accept-Language: en-US,en;q=0.8,ru;q=0.6

我的猜测是,这可能是由超时引起的,但我怀疑某处有几毫秒的超时。以下屏幕截图来自Chrome开发人员工具网络标签,该标签按相同的请求重复过滤多次。

Screenshot from Chrome developer tools / Network

非常感谢任何帮助!

0 个答案:

没有答案