IIS 7 CORS Ajax的SOAP请求 [英] IIS 7 Cors Ajax Soap request
问题描述
我也遇到过,我不能解决问题。
I have encountered a problem that I cant resolve.
我有一些JS(jQuery的)POST皂(在PHP)的请求,code工作在Apache与CORS启用呼叫HTTPS,它工作得很好。
I have some js (jquery) POST soap (over PHP) request code working on Apache with Cors enabled for calling HTTPS, and it worked fine.
我已经迁移到IIS7,设置响应头:
I've migrated to IIS7, set response headers:
Access-Control-Allow-Origin = *
Access-Control-Allow-Methods = POST`
和现在strangly发送时
and now strangly when sending
Content-Type: text/xml;
它被拒绝,但在发送时默认
it is refused, but when sending a default
application/x-www-form-urlencoded
strangly我得到的回应(从SOAP服务器,但仍当然错误响应,即CORS适用于这一点)。
strangly I got the response (of course error response from Soap server but still, meaning that Cors works for this).
所以,问题是,如果有什么东西在IIS头设置?我试着找了一天,但没有运气的答案。我的猜测是,它是关于访问控制 - 允许 - 头
但我仍然不能找到一个有效的例子。
So the question is, if there is anything else to set in iis headers? I tried to find an answer for a day but with no luck. My guess is it is about Access-Control-Allow-Headers
but still I cant find a valid example.
推荐答案
您需要设置下面的头:
Access-Control-Allow-Headers: Content-Type
您可能也不得不把其他的头在该列表中。找出要添加的头,最好的方法是检查对请求访问控制请求报头的头,看看有什么重视其要求,然后回显这些值在上面的响应。
You may also have to put other headers in that list. The best way to figure out which headers to add is to inspect the Access-Control-Request-Headers header on the request, and see what values its asking for, and then echo those values in the response above.
原因内容类型必须包含在这个标题,是因为你所要求的非标值(应用程序/ x-WWW的形式urlen codeD是一个标准值)。
The reason Content-Type needs to be included in this header is because you are asking for a non-standard value ('application/x-www-form-urlencoded' is a standard value).
这篇关于IIS 7 CORS Ajax的SOAP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!