Making changes to Ember's Built-in web servers headers

When running an Ember-cli application via

ember server

Is there a way to alter the headers on the built-in webserver?

So we can alter the headers of the server like so:

res.setHeader('Access-Control-Allow-Origin', '*');

Here is some more information…

I’m running my app via:

ember server --environment=development --proxy http://localhost:3002

This is the error message I’m getting in Chrome:

XMLHttpRequest cannot load https://login.windows.net/domain.com/oauth2/authorize?response_type=co…st%3A3000%2Fauth%2Fcallback&client_id=80077aa3-f7ff-4331-9f82-14bb87a8e1ea. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access

Try:

This did not help. I’m still getting the same error :confused:

You can see the network request in Chrome’s Network tab. Do you see the header? Perhaps windows.net does not accept localhost URL’s. If you see the header perhaps you must first send an HTTP request by the OPTIONS method to the resource on the other domain. ember-fetch will perhaps solve your issues because Fetch(), coming native in Chrome 42, has CORS build-in. I did not had time to try ember-fetch yet.

I tried that too and I still facing the same problem “CORS thing”