简体   繁体   中英

CORS ISSUES on Accessing Web Application on a Browser Outside Azure Virtual Machine

Good day all, I have an Angular and Asp.net Core Application deployed on IIS in Azure Virtual Machine. It is working perfectly work on the IIS Localhost on the AZURE Virtual Machine but when trying to access the Application outside Virtual Machine using the IP address and the Port number, am having CORS Issue from origin 'http://10.95.102.55:95' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

Please what could be the Problem because it is working on the Virtual Machine but outside the Virtual Machine is the problem, Have disable Window Firewall and Set both Inbound and Out-Bound rules on the Port. Please help is needed

Apply the below changes in your deployed application in iis.

<system.webServer>
<httpProtocol>
    <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Methods" value="GET,POST,OPTIONS" />
        <add name="Access-Control-Allow-Headers" value="Content-Type, soapaction" />
    </customHeaders>
</httpProtocol>
</system.webServer>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM