【问题标题】:Flutter web custom domain site not found errorFlutter web 自定义域站点未找到错误
【发布时间】:2022-12-10 15:09:03
【问题描述】:

我在自定义域上部署了我的 flutter 应用程序,但是当我尝试访问该域时,我得到了 firebase 站点未找到页面 this is what I get when I put in my url

当我进入域 firebase 时,页面加载就像正常一样,当我打开 vpn 时,页面加载到自定义域。如果我在 url 的 / 后面放一些东西,页面也会像正常一样加载,所以我会做“app.domain.com/(任何随机词都有效,所以 home 或 random 等)”,它会将我重定向到主页。 when I enter the url with something behind the /

我尝试在多个设备和浏览器上加载页面,删除使用过的浏览器的 cookie 和缓存,使用隐身模式。但似乎没有任何效果。我也试过在不同的位置加载页面,但仍然弹出“找不到站点”。 我也尝试清理我的项目,再次获取我的包并升级它们 flutter cleanflutter pub getflutter pub upgrade

删除了我的 firebase 主机文件并再次运行firebase init。 真是太奇怪了,当连接到 vpn 或在 url 后给定一个随机字符串时,找不到该页面。我还就我的问题联系了谷歌,但他们似乎也无法找到它,因为当支持员工和他的团队尝试时页面加载正确

有人可以帮我吗?

我的 firebase.json 文件

{
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "hosting": {
    "public": "build/web",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

【问题讨论】:

    标签: flutter firebase http-status-code-404 firebase-hosting custom-domain


    【解决方案1】:

    您的 firestore 配置应该包含在托管对象中,因为 firestore 是与托管结合使用的,而不是独立使用的。你的配置应该是:

    {
      "hosting": {
        "public": "build/web",
        "ignore": [
          "firebase.json",
          "**/.*",
          "**/node_modules/**"
        ],
        "rewrites": [
          {
            "source": "**",
            "destination": "/index.html"
          }
        ],
        "firestore": {
          "rules": "firestore.rules",
          "indexes": "firestore.indexes.json"
        }
      }
    }
    
    

    【讨论】:

      猜你喜欢
      • 2020-02-05
      • 2021-01-24
      • 2022-11-15
      • 1970-01-01
      • 1970-01-01
      • 2015-03-03
      • 1970-01-01
      • 1970-01-01
      • 2020-01-18
      相关资源
      最近更新 更多