1

I am trying to implement Flutter web url navigation in my application. When I am trying to open http://localhost:7357/privacy-policy directly it is opening fine on my local machine but when I am trying to open the same URL directly after deploying it on server it is not loading and throwing me errors. enter image description here I am using Firebase to deploy my application.

Everything works fine after deploying when I am trying to access through the home page without any specific navigation for ex: www.example.com, the error comes when I am trying to directly access the page www.example.com/privacy-policy instead of going through home page.

Any help is much appreciate. Thanks.

paras 231096
  • 223
  • 1
  • 2
  • 6
  • problem is your accessing private IP on deployment you have to make this ip public . – Ashutosh singh Apr 04 '22 at 04:34
  • @Ashutoshsingh I didn't understand your comment, what IP are you talking about? My application is working fine after deployment, if I am trying to open a particular page directly through URL navigation that is throwing up this error. – paras 231096 Apr 04 '22 at 09:46

2 Answers2

1

try adding "rewrites" in your firebase.json

"hosting": {
  "rewrites": [ {
    "source": "**",
    "destination": "/index.html"
   } ]
}

and refer to this: When I refresh my website I get a 404. This is with Angular2 and firebase

etainclub
  • 21
  • 6
0

Adding the vercel way (though not asked), as this has bugged me for a while:

{
  "rewrites":  [
    {"source": "/(.*)", "destination": "/"}
  ]
}
Shourya Shikhar
  • 764
  • 1
  • 5
  • 22