dimanche 21 février 2016

Ember.js deployment CORS error with ember-cli-deploy

I've deployed my Ember app using the ember-cli-deploy Lightning Strategy]1. Basically, instead of just moving the Ember assets to the Rails public folder, I'm storing the assets on S3 and using Redis to fetch the content. However, I'm still having issues.

Console errors:

Failed to find a valid digest in the 'integrity' attribute for resource 'http://ift.tt/1Ugcf8s' with computed SHA-256 integrity 'jQneD+vBDVT7ee1Z9kI1izwIriOTtrL9BSbgXhWAyiY='. The resource has been blocked.
GET http://ift.tt/1ovV8mC ## These are 422 Unprocessable Entity errors.
GET http://ift.tt/1Ugchx4 ## These are 422 Unprocessable Entity errors.
Failed to find a valid digest in the 'integrity' attribute for resource 'http://ift.tt/1ovVauG' with computed SHA-256 integrity 'jQneD+vBDVT7ee1Z9kI1izwIriOTtrL9BSbgXhWAyiY='. The resource has been blocked.

I'm mostly concerned about the 422 errors, though I'm not sure why it's still blocking the CSS files.

package.js dependencies:

"devDependencies": {
    "active-model-adapter": "2.1.1",
    "broccoli-asset-rev": "^2.2.0",
    "ember-ajax": "0.7.1",
    "ember-cli": "2.3.0",
    "ember-cli-app-version": "^1.0.0",
    "ember-cli-babel": "^5.1.5",
    "ember-cli-dependency-checker": "^1.2.0",
    "ember-cli-deploy": "0.5.1",
    "ember-cli-deploy-build": "0.1.1",
    "ember-cli-deploy-display-revisions": "0.1.1",
    "ember-cli-deploy-gzip": "0.1.1",
    "ember-cli-deploy-manifest": "0.1.1",
    "ember-cli-deploy-redis": "0.1.1",
    "ember-cli-deploy-revision-data": "0.1.1",
    "ember-cli-deploy-s3": "0.2.1",
    "ember-cli-deploy-ssh-tunnel": "0.2.2",
    "ember-cli-htmlbars": "^1.0.1",
    "ember-cli-htmlbars-inline-precompile": "^0.3.1",
    "ember-cli-inject-live-reload": "^1.3.1",
    "ember-cli-materialize": "git://github.com/robbyoconnor/ember-cli-materialize.git#e39b833f1dfb66b342873d25d05fabcb17b59a3f",
    "ember-cli-qunit": "^1.2.1",
    "ember-cli-release": "0.2.8",
    "ember-cli-sass": "5.2.1",
    "ember-cli-sri": "^2.0.0",
    "ember-cli-uglify": "^1.2.0",
    "ember-composability": "0.1.3",
    "ember-data": "^2.3.0",
    "ember-disable-proxy-controllers": "^1.0.1",
    "ember-export-application-global": "^1.0.4",
    "ember-key-responder": "0.4.2",
    "ember-legacy-views": "0.2.0",
    "ember-load-initializers": "^0.5.0",
    "ember-modal-dialog": "0.8.3",
    "ember-new-computed": "1.0.3",
    "ember-radio-button": "1.0.7",
    "ember-resolver": "^2.0.3",
    "loader.js": "^4.0.0"
}

I had also tried to use ember-cli-cors as described in this SO answer, but that hadn't made a difference.

config/environment.js:

module.exports = function(environment) {
  var ENV = {
    modulePrefix: 'my-app',
    environment: environment,
    baseURL: '/',
    locationType: 'auto',
    EmberENV: {
      FEATURES: {
      }
    },
    APP: {
    },
    contentSecurityPolicyHeader: 'Content-Security-Policy',
    contentSecurityPolicy: {
      'script-src': "'self' 'unsafe-eval' http://my-url.com",
      'style-src': "'self' 'unsafe-eval' http://my-url.com",
    }
  };

  return ENV;
};

CORS configuration on S3:

    <CORSConfiguration>
        <CORSRule>
            <AllowedOrigin>http://ift.tt/1Ugcf8u;
            <AllowedMethod>GET</AllowedMethod>
            <MaxAgeSeconds>3000</MaxAgeSeconds>
            <AllowedHeader>*</AllowedHeader>
        </CORSRule>
    </CORSConfiguration>




Aucun commentaire:

Enregistrer un commentaire