Hosting React-App on gh-pages / godaddy


I’ve built my react-app using create-react-app and made a seperate branch using gh-pages.
The app worked as intended using default URL of

Repository is here

I bought a .com domain from godaddy and changed service to CloudFlare.

I managed the DNS as following,

Points to:

I then added the domain in the gh-pages branch settings, which created the CNAME file with that domain.

However, browsing to that address only results in a blank page with the correct page-title.
I tried removing the CNAME and put it in the master-branch, that defaulted in the .com address leading to the, so the routing seems to work there.

In my package.json I added the following lines,

"homepage": ""
"scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",

And built the app through yarn deploy.

Any suggestions?

1 Like

Hi Fredrik

The url ( works for me, screenshot below.

Assuming you managed to find a solution? If not, it might be something as simple as a dns cache in your browser stopping you seeing it correctly. Try clearing that.

Your site looks great btw :+1:

Hope that helps :slight_smile:

Yes, it’s working now.
I had to change the “homepage” in package.json to “”,
as well as readjusting the routes for the router to match that url.
Thought the homepage was where the files were hosted, not to the custom domain.

Thank you! :slight_smile:

Hey Ronnehag,

Just wanna say thank you for your post, I’ve been trying to figure this out for a night until stumbling upon your post. It finally works!

What works for me is:

change the “homepage” in package.json to

Go Daddy -
Points to:
CNAME www [my-username]

And the one last KEY is
under my github repo/ setting/ github page,
I change the “custom domain” from

will forward users to
but I still need to put the second url with the www in the “custom domain” for github page to work

It sounds stupid, but it finally works!