How to solve 'Redirect has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header'? IIS

if you get into this error " IIS has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status."


Fix
 Install this extension

https://www.iis.net/downloads/microsoft/iis-cors-module


and add this to web.config

<system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="Access-Control-Allow-Origin" value="http://website_name" />
        <add name="Access-Control-Allow-Credentials" value="true" />
        <add name="Access-Control-Request-Headers" value="User-Agent,Content-Type,Authorization,X-RequestDigest,X-ClientService-ClientTag" />
        <add name="Access-Control-Request-Method" value="GET,POST,HEAD,OPTIONS" />
      </customHeaders>
    </httpProtocol>
Axact

Manusha Amal

Hi, I am Manusha. Currently working as Systems Engineer. I

Post A Comment:

0 comments:

දිරියක් වෙන්න අදහස් පෙළක් දාන්න