Internet Explorer CORS issue

Hey all,

Has anyone had any issues with IE11 and CORS? My SPA won’t run on IE11 with the error: “Required cross origin resource sharing (CORS)”.

I’ve tried turning it off, but still no luck. Does anyone have an idea on how to fix this?

Thanks

Are you sure it’s an IE11 issue? Tried with another browser?

Yup, it works on Opera, Safari, Chrome, Firefox, Android, iOS and even Edge… but not on IE11.

Ahh interesting, can you share your config/cors.js config file, I will look into it

With IE you can face anything, including paranormal issues.

2 Likes

Of course. Here’s the cors.config:

'use strict'

module.exports = {
  origin: false,
  methods: ['GET', 'PUT', 'POST'],
  headers: true,
  exposeHeaders: false,
  credentials: false,
  maxAge: 90
}

I found this also, so it does seem like it’s an issue with IE 11. https://stackoverflow.com/questions/9514179/how-to-find-the-operating-system-version-using-javascript

@virk any idea what the issue might be?

Hi @twigs67

I don’t have IE to test, but it should be origin:true to allow CORS from everywhere.
It’s odd that other browsers do not throw CORS errors tho.

Do you have some proxies between? Apache / Nginx / HAProxy or something similar?

Yeah the cors origin must be true. Disabling it and then making cross origin requests will surely be disallowed

I am using an AWS loadbalancer and nginx. I’ve tried setting it to true, but it still doesn’t work. I’ve noticed it’s only on older versions of IE though.

Hey my friend.

I don’t know if this is going to help you, but I had a lot of problems with IE11, including the Fetch problem, my solution:

With webpack:

entry: {
    formLogin   : ["@babel/polyfill",   "./src/scripts/formLogin.js"],
    formIndex   : ["@babel/polyfill",   './src/scripts/formIndex.js'],
    formKit     : ["@babel/polyfill",   './src/scripts/formKit.js'],
    formReset   : ["@babel/polyfill",   './src/scripts/formResetPassword.js'],
    formSign    : ['./src/scripts/signUp.js']
},

And also I added to the page:

<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js"></script>
<script nomodule src="https://unpkg.com/browser-es-module-loader/dist/babel-browser-build.js"></script>
<script nomodule src="https://unpkg.com/browser-es-module-loader"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/2.0.3/fetch.js"></script>

I hope you can figure out this.
Best Regards.