Github pages for FF, refreshing a sub page shows 404 error

I have published my FF web app to Github pages, and use CloudFront with a cname setting to get my domain running properly.
All works well, I can actively login and navigate to all the pages within the app itself (x.y.com/home, x.y.com/settings etc.), however, if I refresh any of the pages that I am on, I get a 404 error, and have to manually change the url back to root (x.y.com).

Any thoughts on how to resolve that?

I have a second issue, in that the domain config is set in a file called cname, in the root of the site. Every time I push to Github from FF, I have to manually add the file back to root in Github itself, so it can be included in the build. Is there any way to create the file in FF itself, so that it is included when I push to Github?

2