'access-control-allow-origin' accessing re

2019-08-21 17:49发布

I am trying to call Tosca's rest api from my server and it's giving me this exception: 'access-control-allow-origin'. Since I have no control over Tosca's response, is there a way to get around this exception?

标签: tosca
1条回答
一夜七次
2楼-- · 2019-08-21 18:04

Most likely the issue is not related to Tosca REST API, rather is a CORS problem. So, I am assuming your web server and the Tosca REST API server are on different domain. You can basically bypass this problem by allowing cross-origin requests from the web application, by adding the following configuration to the web.config

<system.webServer>
<httpProtocol>
  <customHeaders>
    <add name="Access-Control-Allow-Headers" value="Content-Type" />
    <add name="Access-Control-Allow-Methods" value="GET, POST" />
    <add name="Access-Control-Allow-Origin" value="*" />
  </customHeaders>
</httpProtocol>
</system.webServer>
查看更多
登录 后发表回答