i have this routes in my index.js
<Router history={customHistory}>
<div className="row">
<Switch>
<Route exact path="/login" component={Login}/>
<Route path="/home" component={Home}/>
<Route path="/politicas" component={Policies}/>
<Redirect exact from="/" to="/login"/>
<Route exact path="*" status={404} component={NotFound}/>
</Switch>
</div>
</Router>
In local enviroment always works but i have one firebase application, to deploy my firebase project i use:
npm run build
and
firebase deploy
But in firebase app after deep refresh returns 404, the only route that works is "/", What do I have to do to keep the routes always working with any path?
I answer myself, it is necessary to add the following to the file firebase.json
"hosting": {
// Add the "rewrites" section within "hosting"
"rewrites": [ {
"source": "**",
"destination": "/index.html"
} ]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With