我对Cors有一些问题。 我在https中拥有域,通过ajax调用public api。我在web.config中将此添加到了网站根目录:
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="https://it.mysite.com" />
</customHeaders>
</httpProtocol>
即使我添加了此内容,它也会阻止通话:
Failed to load https://www.site-a.com: Redirect from 'https://www.site-a.com' to 'https://www.site-a.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://it.mysite.com' is therefore not allowed access.
进行调用的js文件位于子文件夹中,但不应该是遗传的吗?