I am encountering CORS errors in Firefox and IE, but everything is functioning properly in Chrome.
The two requests causing the issue are
- A general call to Facebook which works in Chrome and Firefox, but fails in IE 11. I am making a request to verify the validity of the token by calling . In IE, I am encountering this error: XMLHttpRequest for required Cross Origin Resource Sharing (CORS).
- The second request is to my server which has CORS enabled everywhere (code provided below). The strange thing is that both requests are on localhost so they should be on the same server. The error message I am getting is "The Same Origin Policy disallows reading the remote resource at https://localhost:44300/api/auth/login. This can be fixed by moving the resource to the same domain or enabling CORS."
CORS related Web API code
var cors = new EnableCorsAttribute("*","*","*");
config.EnableCors(cors);
app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
Update 1
Interestingly, it functions when deployed to Azure, but not on localhost. Both these issues are resolved once deployed. It's quite perplexing as I need to test locally. Nonetheless, it provides some insights into solving the issue.
Update 2
Consistently working when deployed (even though the client and server are on different domains) and failing on localhost. I have not been able to pinpoint why it fails locally. Despite clearing cache and deleting local files, the issue persists. Even after completely opening up my server to CORS, the problem remains. My only assumption is how Azure handles cross-Azure requests, potentially bypassing the CORS issue during deployment. Nevertheless, I must figure out a way to make it work locally for testing purposes.