I have a C# MVC app with some React components.
Chrome works fine, but Edge is throwing a Origin https.... not found in Acces-Control-Allow-Origin Header
I've read pretty much everything related to CORS and MVC, but can't find a fix.
What i've tried so far ->
Web.Config
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />
<add name="Access-Control-Allow-Methods" value="GET,POST,PUT,DELETE,OPTIONS" />
<add name="Access-Control-Allow-Credentials" value="true" />
</customHeaders>
</httpProtocol>
Custom CORS handler
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Origin", "*");
filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Headers", "*");
filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Credentials", "true");
base.OnActionExecuting(filterContext);
}
[AllowCrossSite]
public class ReactController : Controller {....}
None of the above seem to be working. Edge still throws the CORS error (even tho' its about a resource on the same domain (perhaps related to npm packages or something).
Any tip?
Edit: Forgot to mention (perhaps it will help). This console.log does get triggered, but nothing beyond that point.
import * as React from 'react';
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import { DetailsList, DetailsListLayoutMode, Selection, buildColumns } from 'office-ui-fabric-react/lib/DetailsList';
import { MarqueeSelection } from 'office-ui-fabric-react/lib/MarqueeSelection';
import { Checkbox } from 'office-ui-fabric-react/lib/Checkbox';
import { createRef } from 'office-ui-fabric-react/lib/Utilities';
import { initializeIcons } from 'office-ui-fabric-react/lib/Icons';
import { css, classNamesFunction } from 'office-ui-fabric-react/lib/Utilities';
import { DefaultButton, IButtonProps } from 'office-ui-fabric-react/lib/Button';
import { Label } from 'office-ui-fabric-react/lib/Label';
initializeIcons(/* optional base url */);
console.log("Initialized ");
UPDATE: I think i found out where my problem is (or another one related to the amazing EDGE).
The problem might be the fact that im loading a list that depends on a specific fetch request (im building a sharepoint provider hosted add-in). MS Edge seems to hate the OPTIONS
Http Verb as it throws an error saying it is not supported....
Any idea on how i could fix this?