html - 无法使用 Firebase 托管访问子目录中的任何文件
问题描述
我有一个托管在 Firebase Hosting 中的网站,当我从当前public
文件夹加载内容时它工作正常。但我无法从像/img/logo.png
.
我在这里和互联网上搜索过,但没有找到有效的解决方案。我试过一些类似的问题:
我的包括就像<script src="js/index.js"></script>
我的firebase.json
:
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"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"
} ]
}, {
"source" : "404.html",
"headers" : [ {
"key" : "Cache-Control",
"value" : "max-age=300"
} ]
} ]
}
}
解决方案
firebase deploy
通过在 Windows 上的 Ubuntu 上运行 Bash解决了这个问题。
以前,我在普通的 Windows 10 上使用 firebase cli。
推荐阅读
- android - 一个布局中的 TextView 内容进入另一个布局
- autodesk-forge - Forge Viewer 中模型的默认材质
- javascript - 'firebase' 不是内部或外部命令、可运行程序或批处理文件
- android-studio - Android Studio 显示主目录而不是项目
- android - 未调用 onNewToken()
- spring - 本地服务器无法在 sprin web mvc 中找到 welcome.jsp 文件
- c# - 简单的 C# 白名单,查找用户名和过期的问题
- python - np.ndarray`“是”中的奇怪行为
- android - 舞台线条画
- c# - 如何在 WinForm 应用程序中持续监控用户输入