leo*_*ojh 6 cors ember.js ember-cli
如何在内置的ember-cli服务器上对字体文件(或任何其他静态资源)的请求设置CORS?
这是仅供参考的错误消息:
Font from origin 'http://some-domain:4200' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:61277' is therefore not allowed access.
Run Code Online (Sandbox Code Playgroud)
在 config/environment.js 的 ENV 中添加以下内容:
module.exports = function(environment) {
contentSecurityPolicyHeader: 'Content-Security-Policy',
contentSecurityPolicy: {
// ... other stuff here
'font-src': "'self' http://some-domain:4200",
},
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4551 次 |
| 最近记录: |