I want to call an API from an html page with angularjs and I have written this script code in html page
$http({
method:'POST',
url:'http:192.200.2.2/example.com/api/value',
headers:{
X-EXAMPLE.COM-WEB-APP-API-KEY:"ghdhfghgfhdfdf76878678687567",
X-EXAMPLE.COM-WEB-APP-API-SECRET:"hfghdfghdhfghdf76878678687567",
Content-Type:"application/json"
}
});
I have written in web.config of api,
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="*" />
<add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS" />
</customHeaders>
</httpProtocol>
<security>
<requestFiltering>
<verbs>
<add verb="OPTIONS" allowed="true" />
</verbs>
</requestFiltering>
</security>
</system.webServer>
without headers it is calling an api but with header it is not calling an api & I can't use any backend code