Ember 应用程序部署到多个存储桶时出现安全错误

SecurityError When Ember Application Deployed to Multiple Buckets

我已将 index.html 文档部署到 www.lorem.io 存储桶,并将其余资产部署到 cdn.lorem.io 存储桶。这两个桶都有自己的 Cloudfront 发行版。访问 https://www.lorem.io/ 时,我收到以下错误:

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/'.

您 ember.js 配置文件将 rootURL 定义为 "https://cdn.lorem.io",这是错误的。访问 lorem.io 时,您的 rootURL 应该是 "https://www.lorem.io".

也许你的意思是 baseURLrootURLbaseURL 的区别见 this explanation

警告:请记住,baseURL gets deprecated 在 ember-cli 2.7.

我们的配置文件中的 locationType 设置在生产中是 hash

在ember.js配置文件中,您能否将您的位置类型更改为hash,然后重试:

ENV.locationType = 'hash';

From Guide

From a discussion on github