How can I load a specific url page using Firebase Hosting for Flutter Web
Asked Answered
J

1

8

I'm using Getx for navigation which internally uses Navigator 2.0. I'm unable to load a specific URL when I Host in Firebase Hosting.

It seems to be working fine locally.

I'm using Url Path Strategy to remove the #

Johnston answered 9/3, 2022 at 20:22 Comment(3)
In the file web/index.html: Is the base that set to <base href="/">?Classicize
so what happens when you try to load specific url?Spaniard
@Spaniard Firebase Hosting will attempt to serve a page for that URL, which doesn't exist, and thus result in a 404.Yamauchi
R
4

Check if you correctly rewrite all requests to /index.html

https://firebase.google.com/docs/hosting/full-config

firebase.json:

{
  "hosting": {
    "public": "www",
    "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  },
    ...

Deploy again afterwards.

Rotary answered 9/6, 2022 at 5:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.