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>

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

Post a Comment (0)
Previous Post Next Post