Search code examples
ember.jsamazon-s3amazon-cloudfront

SecurityError When Ember Application Deployed to Multiple Buckets


I have my index.html document deployed to a www.lorem.io bucket and the rest of my assets deployed to a cdn.lorem.io bucket. Both of these buckets have their own Cloudfront distributions. When visiting https://www.lorem.io/ I'm receiving the following error:

Uncaught SecurityError: Failed to execute 'replaceState' on 'History': A history state object with URL 'https://cdn.lorem.io/' cannot be created in a document with origin 'https://www.lorem.io' and URL 'https://www.lorem.io/'.


Solution

  • You're ember.js configuration file defines rootURL to be "https://cdn.lorem.io" which is wrong. When accessing lorem.io your rootURL is supposed to be "https://www.lorem.io".

    Perhaps you meant baseURL. See this explanation for the difference between rootURL and baseURL.

    Warning: Keep in mind, that baseURL gets deprecated in ember-cli 2.7.