我正在使用Firebase Hosting来托管一些脚本,并尝试从另一个站点访问它们。由于CORS问题,它自然会被阻止。根据我在其他论坛线程等地的研究,我修改了firebase.json如下:
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"headers": [ {
"source" : "**",
"headers" : [ {
"key" : "Access-Control-Allow-Origin",
"value" : "*"
} ]
}]
}
}
这基本上允许任何URL访问托管在此处的资源。然而,在尝试运行我的站点时,我仍然看到以下内容
Access to XMLHttpRequest at 'https://oracle-bot-sdk.firebaseapp.com//loader.json'
from origin 'https://insurance-bot.moblize.it' has been blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
还需要什么?