'Getting 404-Page Not Found error, when i reload my react application which is on firebase
Solution 1:[1]
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.
Solution 2:[2]
Add a 'rewrite' rule in your firebase.json file. Your firebase.json file should look like this:
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"hosting": {
"public": "build",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Bassem |
Solution 2 | Lotanna Kyrian |