Error only on IE 11: XMLHttpRequest: Network Error 0x800c0019, Security certificate required to access this resource is invalid

0

Please bear with me I am new to CORS and vueJS, and I know there have been similar questions posted but I haven't been able to find a solution that works for me. I am getting the following error (only on IE 11, works for Chrome)

XMLHttpRequest: Network Error 0x800c0019, Security certificate required to access this resource is invalid.

Here is my fetch request:

 fetch("https://localhost:44378/api/query/DevEntity?rs=cmg,admd,dd,tlos,mrds&_myr=2018&_met=HIG&cmg=811&dd&_sdd=20180101&_edd=20180501&sm=tlos,avls,cc&org=1&or=dd&od=true",{
      method: 'GET',
      headers: {
      'Content-Type': 'Application/Json'
    }
    })
    .then((response) => {
      return response.json()
    })
    .then((jsonData) => {
      alert(jsonData.results);
    });

I have installed isomorphic-fetch for 'fetch' support in IE 11 and I am using fetch for an online API request which is working fine. Also getting the same error (only on IE) if I use axios get request. I can assure API URL is valid.

Here is the CORS call to allow cross domain request (since my app is running on 8080):

  // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddCors(options =>
        {
            options.AddPolicy(MyAllowSpecificOrigins,
            builder =>
            {
                builder.WithOrigins("http://localhost:8080").WithHeaders("*").WithMethods( "GET","POST", "PUT").AllowCredentials();    
            });
        });
        services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
    }

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
            app.UseHsts();
        }

        app.UseCors(MyAllowSpecificOrigins);
        app.UseHttpsRedirection();
        app.UseMvc();
    }

I have tried the following:

  1. Enable "Access data sources across domains" in internet options.
  2. Converting the fetch call to axios (with es6 promise, works on chrome).
  3. Using AllowAnyHeader().AllowAnyMethod() in cors
  4. Basically every Internet Options config mentioned online for this error
  5. Using network address instead of localhost in cors

Any help on this would be greatly appreciated, It has been bugging me for last 3 days. Thanks in advance!

ssl
fetch
asp.net-core-webapi
asp.net-core-2.2
asked on Stack Overflow Oct 15, 2019 by dhruvwalter • edited Oct 15, 2019 by sideshowbarker

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0