ember.js - Configure CSP in an Ember CLI application which uses http-mock -
i'm using http-mock ember cli suggested on http://www.ember-cli.com/#ember-data. understand basic concept of csp don't understand configuration of within ember cli application.
how can configure application either accept requests localhost:4200/api/
avoid during development:
content security policy violation: { "csp-report": { "document-uri":"http://localhost:4200/products", "referrer":"", "violated-directive":"style-src 'self'", "effective-directive":"style-src", "original-policy":"default-src 'none'; script-src 'self' 'unsafe-eval' localhost:35729 0.0.0.0:35729; font-src 'self'; connect-src 'self' ws://localhost:35729 ws://0.0.0.0:35729 http://0.0.0.0:4200/csp-report; img-src 'self'; style-src 'self'; media-src 'self'; report-uri http://0.0.0.0:4200/csp-report;", "blocked-uri":"", "source-file":"chrome-extension://alelhddbbhepgpmgidjdcjakblofbmce", "line-number":1,"column-number":20481,"status-code":200 } }
you can adjust content security policy editing config/environment.js
. believe in case, connect-src
relevant error being thrown (edit: looks style-src
being violated, possibly chrome extension awesome screenshot). adding *
allow connect anything.
var env = { ... contentsecuritypolicy: { 'default-src': "'none'", 'script-src': "'self'", 'font-src': "'self'", 'connect-src': "'self' *", 'img-src': "'self'", 'style-src': "'self' *", 'media-src': "'self'" } }
or more specifically, add:
... 'connect-src': "'self' 'localhost:4200'", ...
furthermore, if wanted add dev environment, put in:
if (environment === 'development') { env.contentsecuritypolicy = { ...(policies)... } }
more information available csp in ember-cli
: https://www.npmjs.com/package/ember-cli-content-security-policy.
more information csp in general: http://content-security-policy.com/
Comments
Post a Comment