Nextjs on firebase hosting returns 404 on page refresh

Viewed 765

I've searched the documentation, and I can't seem to figure out why if you refresh the working page on firebase hosting, it'll throw a 404. The site works perfectly unless you try to directly access a page, or if you refresh the page (my guess is there's a disparity between the client browser state and the server state). Any ideas?

The site: rockgodstudios.com

2 Answers

It was cleanUrls. Like a dummy, I had it outside of the hosting JSON. Moving it correctly fixed my issue. Posting for anybody in the future that has this issue.

I solved this with the help of this other issue:

Next JS on Firebase Hosting

Although this makes that every time you refresh on any page you're redirected to the "Home" page. In my case this was ok.

Related