gpt4 book ai didi

ember.js - 为 ember-cli 服务器上的静态文件设置 CORS

转载 作者:行者123 更新时间:2023-12-04 15:10:57 25 4
gpt4 key购买 nike

如何在内置 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.

最佳答案

在 config/environment.js 的 ENV 中添加以下内容:

module.exports = function(environment) {
contentSecurityPolicyHeader: 'Content-Security-Policy',
contentSecurityPolicy: {
// ... other stuff here
'font-src': "'self' http://some-domain:4200",
},
}

关于ember.js - 为 ember-cli 服务器上的静态文件设置 CORS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27736272/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com