CORS error when trying to retrieve data from port 8080 using JSONAPIAdapter

I’m trying to retrieve JSON data from an app running on localhost:8080. However, I’m running into an issue it’s not allowing me to make that network request due to the Cross-Origin Request being blocked. I used the command “ember s -proxy http://localhost:8080” in my terminal, but the CORS issue still happens. The error also states the reason for this is that the Access-Control-Allow-Origin header is missing. Where would I need to add the this header? Would be within, or outside of the Ember app?

Did you change your app code to request from localhost:4200 (assuming your ember app is on the default port) instead of localhost:8080? The proxy argument to ember s puts the proxy on that port, precisely to avoid CORS trouble.

I used ember s --proxy http://localhost:4200, and I’m encountering the same problem. (If that’s what you meant, I’m still a bit new to Ember.)

No, you’d want to keep using ember s --proxy http://localhost:8080 . That’s telling ember-cli where it should get the real data.

But in your actual app code, you need to change the data fetching code to talk to localhost:4200, not localhost:8080. The proxy is supposed to “hide” localhost:8080 from your app, so there’s no cors trouble.