我遇到了一个奇怪的问题.我有一个(我认为)在我的服务器上安装CORS,但它在页面刷新后只工作一次.所有其他请求都被跳过或删除.XHR的状态为0,并且没有响应文本(我知道期望HTTP 204的任何文本是愚蠢的)或statusText,但readyState是4.
请求OPTIONS标头:
OPTIONS http://domain2.xx HTTP/1.1 Host: domain2.xx Proxy-Connection: keep-alive Access-Control-Request-Headers: origin, content-type Access-Control-Request-Method: POST Origin: http://domain1.xx Accept: */*,image/webp Referer: http://domain1.xx/index.html User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/47.0.2526.107 Mobile/13C75 Safari/601.1.46 Accept-Encoding: gzip, deflate, sdch Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4
响应OPTIONS标题是:
HTTP/1.1 204 No Content Server: nginx Date: Sat, 19 Dec 2015 14:56:10 GMT Content-Type: text/plain Access-Control-Allow-Credentials: true Access-Control-Allow-Headers: Origin,Cache-Control,Content-Type,Cookie,X-Requested-With,Accept,Authorization,Accept-Language,Content-Language,Last-Event-ID,X-HTTP-Method-Override Access-Control-Allow-Methods: GET,POST,OPTIONS Access-Control-Allow-Origin: http://domain1.xx Access-Control-Expose-Headers: Access-Control-Allow-Origin Access-Control-Max-Age: 0 Cache-Control: max-age=0 Set-Cookie: ******; Expires=Thu, 31 Dec 2037 23:55:55 GMT; Max-Age=315576000; Path=/; HttpOnly Connection: keep-alive
这只发生在iOs上的Chrome中.所有其他浏览器都表现良好.(根本不是我的意思是IE8 +,Chrome(Win7 +,MacOs,Linux,Android),FF(Win7 +,MacOsX,Linux,Android),Safari(MacOsX,iOs),Opera(Win7 +,Linux,Android,iOs),Coast iOs, UC浏览器(android,iOs),也许我可以忘记一些工作正常的地方).
谢谢