在我的应用程序中的静态文件上传到GCS和设定为公开链接。 当请求的静态资源(在这种情况下,字体)它击中像https://example.com/static/fonts/font.woff
一个URL服务器然后将请求重定向到apropriate GCS URL送达。谷歌云存储字体CORS问题
这里的问题是,与镀铬我得到这个CORS问题:
xxxxxxxxe3b8ccc0e3:1 Font from origin 'https://storage.googleapis.com' has been blocked from loading by Cross-Origin Resource Sharing policy: A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'https://example.com' is therefore not allowed access.
在桶中的CORS默认值和所有子文件夹设置像这样:
[{"origin": ["*"], "responseHeader": ["Content-Type"], "method": ["GET"], "maxAgeSeconds": 3600}]
问题是在哪里此凭据标志设置? 我做重定向到公共链接,所以它不是ajax请求,链接是在css文件的font-face声明。
也实在是没有原点设置为域的特定的域或目录,因为我的应用程序是多租户和有访问同一文件的多个不同域的选项。
这似乎当请求来自http
正常工作,但给出了这样的错误,当上https
也可正常工作在Safari,但不适用于Chrome。
你是如何加载字体的?你在CSS文档中使用@ font-face吗? –
@BrandonYarbrough是的正确。 '@ font-face {...}' – aschmid00
我无法重现此问题。您可以粘贴您从storage.googleapis.com获得的请求/响应(移除auth的东西?)我创建了一个Web字体,其中包含您创建的确切CORS策略,但未看到此问题:https:// yarbrough-cors -test.storage.googleapis.com/index.html –