0

I am connecting to localhost to consume json data. However, I am getting these errors as shown below: enter image description here

I've tried the solution outlined here: Violating Content Security Policy directive after ember-cli 0.0.47 upgrade (adding the contentSecurityPolicy field in my environment.js) And http://discuss.emberjs.com/t/help-resolving-error-report-only-refused-to-load-the-script/6902

And there's still the content-security policy error.

Side note: it's able to successfully get the json data from the localhost (status is 200 as a response) but it's not able to show on ember

Community
  • 1
  • 1
macmania314
  • 457
  • 2
  • 18

1 Answers1

1

I was able to figure out what was causing the error, first I need to ensure that in my contentSecurityPolicy field stored in environment.js are the following

contentSecurityPolicy: { 
    ...
    ...
    'connect-src': "'self' 127.0.0.1:8000"
    ...
}

with no quotes on the server url. For the second error I was having, I followed this: https://github.com/ottoyiu/django-cors-headers

Because I was using same port - was bound to run with problems in cross origin resource usage, I needed to tweak the server settings to accommodate same origin resource. Hope that helped someone.

macmania314
  • 457
  • 2
  • 18