# Hosting React-App on gh-pages / godaddy

**URL:** <https://forum.freecodecamp.org/t/hosting-react-app-on-gh-pages-godaddy/249884>\
**Category:** General\
**Created:** [January 7, 2019, 12:33pm UTC](https://forum.freecodecamp.org/t/hosting-react-app-on-gh-pages-godaddy/249884 "2019-01-07T12:33:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronnehag](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ronnehag/32/106719_2.png) [@Ronnehag](https://forum.freecodecamp.org/u/Ronnehag)\
**Post date:** [January 7, 2019, 12:33pm UTC](https://forum.freecodecamp.org/t/hosting-react-app-on-gh-pages-godaddy/249884/1 "2019-01-07T12:33:18Z")

</div>

Hello.

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 [ronnehag.github.io/react-portfolio](http://ronnehag.github.io/react-portfolio).

Repository is [here](https://github.com/Ronnehag/react-portfolio)

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

I managed the DNS as following,

> Points to:  
> 185.199.108.153  
> 185.199.109.153  
> 185.199.110.153  
> 185.199.111.153  
> CNAME www [ronnehag.github.io](http://ronnehag.github.io)

I then added the domain [fredrikronnehag.com](http://fredrikronnehag.com) 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 readme.md, so the routing seems to work there.

In my package.json I added the following lines,

```auto
"homepage": "http://ronnehag.github.io/react-portfolio"
"scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",

```

And built the app through yarn deploy.

Any suggestions?

---

<div class="post-metadata">

**Author:** ![phatbhoy67](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/phatbhoy67/32/64805_2.png) [@phatbhoy67](https://forum.freecodecamp.org/u/phatbhoy67)\
**Post date:** [January 7, 2019, 5:13pm UTC](https://forum.freecodecamp.org/t/hosting-react-app-on-gh-pages-godaddy/249884/2 "2019-01-07T17:13:19Z")

</div>

Hi Fredrik

The url ([https://fredrikronnehag.com/](https://fredrikronnehag.com/)) works for me, screenshot below.

 ![image](https://global.discourse-cdn.com/freecodecamp/original/3X/2/7/278fb4c34fa408c0aee1c04c66c6061f78024b3f.png)

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 👍

Hope that helps 🙂

---

<div class="post-metadata">

**Author:** ![Ronnehag](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ronnehag/32/106719_2.png) [@Ronnehag](https://forum.freecodecamp.org/u/Ronnehag)\
**Post date:** [January 7, 2019, 6:36pm UTC](https://forum.freecodecamp.org/t/hosting-react-app-on-gh-pages-godaddy/249884/3 "2019-01-07T18:36:27Z")

</div>

Yes, it’s working now.  
I had to change the “homepage” in package.json to “[http://www.fredrikronnehag.com/](http://www.fredrikronnehag.com/)”,  
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! 🙂

---

<div class="post-metadata">

**Author:** ![davidhuang620](https://avatars.discourse-cdn.com/v4/letter/d/c4cdca/32.png) [@davidhuang620](https://forum.freecodecamp.org/u/davidhuang620)\
**Post date:** [April 22, 2019, 6:00am UTC](https://forum.freecodecamp.org/t/hosting-react-app-on-gh-pages-godaddy/249884/4 "2019-04-22T06:00:29Z")

</div>

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  
`http://www.[my-website].com/`

Go Daddy -  
Points to:  
185.199.108.153  
185.199.109.153  
185.199.110.153  
185.199.111.153  
CNAME www [my-username].github.io

And the one last KEY is  
under my github repo/ setting/ github page,  
I change the “custom domain” from  
`[my-website].com`  
to  
`www.[my-website].com`

Although  
`[my-website].com`  
will forward users to  
`www.[my-website].com`  
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!

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 9:51am UTC](https://forum.freecodecamp.org/t/hosting-react-app-on-gh-pages-godaddy/249884/5 "2021-01-17T09:51:04Z")

</div>


