Search code examples
reactjsfirebasefirebase-hosting

Getting 404-Page Not Found error, when i reload my react application which is on firebase


I have deployed my react application on firebase, when i reload the page it is showing the below page. enter image description here

Firebase.json

{
  "hosting": {
    "public": "build",
    "ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
  }
}

NOT A SINGLE PAGE APP


Solution

  • Add the following rewrites rules:

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

    This will ensure that Firebase will serve up your React app for any route requested.