相关疑难解决方法(0)

是否忽略Cors Access-Control-Allow-Headers通配符?

我无法使用chrome获得跨域cors请求以正常工作.

请求标题:

Accept:*/*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Access-Control-Request-Headers:origin, content-type
Access-Control-Request-Method:POST
Connection:keep-alive
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4
Run Code Online (Sandbox Code Playgroud)

响应标头:

Access-Control-Allow-Headers:*
Access-Control-Allow-Origin:*
Allow:GET, POST, OPTIONS
Content-Length:0
Date:Tue, 30 Oct 2012 20:04:28 GMT
Server:BaseHTTP/0.3 Python/2.7.3
Run Code Online (Sandbox Code Playgroud)

错误:

XMLHttpRequest cannot load domain. Request header field Content-Type is not allowed by Access-Control-Allow-Headers.
Run Code Online (Sandbox Code Playgroud)

并且为选项请求提供的python代码是:

self.send_response(200)
self.send_header('Allow', 'GET, POST, OPTIONS')
self.send_header('Access-Control-Allow-Origin', '*')
self.send_header('Access-Control-Allow-Headers', '*')
self.send_header('Content-Length', '0')
self.end_headers()
Run Code Online (Sandbox Code Playgroud)

似乎忽略了Access-Control-Allow-Origin通配符?

browser http cors

115
推荐指数
3
解决办法
13万
查看次数

标签 统计

browser ×1

cors ×1

http ×1