As github pages allow custom 404 page per this document. It has become a way to serve single page application on github pages. However it still return 404 status code underlyingly
I wish we would have a way to suppress this error and allow 200 status code to be returned. Or maybe allow url rewriting in github pages so we can serve SPA from here
You could use JavaScript to redirect away from that 404 page. Not saying it’s a very good idea though, but it’ll work. If you really need that support for rewriting URLs maybe GH Pages isn’t the best fit. You could consider using a different free service with support for that such as Netlify instead.