【发布时间】:2018-01-14 04:03:13
【问题描述】:
我收到以下错误:
XMLHttpRequest 无法加载 https://code.getmdl.io/1.3.0/material.indigo-pink.min.css。不 请求中存在“Access-Control-Allow-Origin”标头 资源。原点“https://nhalistonfirebase.firebaseapp.com”是 因此不允许访问。
这是我的 firebase.json 文件:
{
"hosting": {
"public": "public",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
// Add the "headers" section within "hosting".
"headers": [
{
"source": "**/*.@(eot|otf|ttf|ttc|woff|font.css)",
"headers": [
{
"key": "Access-Control-Allow-Origin",
"value": "*"
}
]
},
{
"source": "**/*.@(jpg|jpeg|gif|png)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=7200"
}
]
}
]
}
}
应该如何纠正?
【问题讨论】:
标签: google-chrome firebase cors material-design firebase-hosting