If you are receiving a 404 error on refresh what is most likely happening is the url is put in incorrectly but can be reached the first time through an automatic redirect. I would suggest checking your network activity when refreshing the page to see if the refresh causes the url to change.
I also found some other reasons on why things may occur on refresh that are unexpected.