阻止Angular $ http帖子中的OPTIONS请求

时间:2014-05-07 18:13:55

标签: angularjs cors

我在www.development.myapp.com上提供的网页正在尝试向ws.development.myapp.com/v2/AppService.asmx发送$ http帖子。

我是否正确地假设此配置不是跨域情况(因为它们共享相同的顶级域)? CORS已配置好,一切正常。但我想阻止所有浪费的OPTIONS电话,因为我不认为这甚至是一个真正的跨域情况(除非我误解了某些内容)。

帖子本身的生成非常简单:

$http.post(url, data);

这是Chrome为OPTIONS调用捕获的内容:

Remote Address:107.23.95.40:80
Request URL:http://ws.development.myapp.com/v2/AppService.asmx/GetFeaturedItem
Request Method:OPTIONS
Status Code:200 OK
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Access-Control-Request-Headers:accept, content-type
Access-Control-Request-Method:POST
Cache-Control:no-cache
Connection:keep-alive
Host:ws.development.myapp.com
Origin:http://www.development.myapp.com
Pragma:no-cache
Referer:http://www.development.myapp.com/posts
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36
Response Headersview source
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept
Access-Control-Allow-Origin:http://www.development.myapp.com
Access-Control-Expose-Headers:true
Allow:OPTIONS, TRACE, GET, HEAD, POST
Content-Length:0
Date:Wed, 07 May 2014 17:59:25 GMT
Public:OPTIONS, TRACE, GET, HEAD, POST
Server:Microsoft-IIS/7.5
X-Powered-By:ASP.NET

0 个答案:

没有答案