Question

How to I stop the domain name changing to the droplet's IP in the URL.

So I made a small but simple website with Node and Express on my droplet, and I can access the website using the IP of the droplet. I have also recently register for a domain with GoDaddy. I have also followed this guide to connect the domain with the droplet. However, when I enter in www.mydomain.com into the URL bar, it changes the domain to 123.456.78.910, which is the IP of my droplet. Is there any way to fix this?

EDIT: Ok, the URL now doesn’t change the domain to the IP. I have no idea how it fixed itself. I guess I just needed to give it time to fix itself.

Show comments

Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

alexdo
Site Moderator
Site Moderator badge
January 22, 2023

Hello @bossmania412

The redirect might have been caused due to DNS propagation/cache or if you’re using PM2 a restart might have just done the trick for you.

I would also recommend to use Nginx as a reverse proxy to complete the setup.

Regards

KFSys
Site Moderator
Site Moderator badge
January 21, 2023

Hi @bossmania412,

That’s weird, the issue was resolved by itself, nevertheless, can you share your configuration? Are you using Nginx as a reverse proxy, what is your configuration and stuff like that?

I’m eager to hear from you :)

Bobby Iliev
Site Moderator
Site Moderator badge
January 20, 2023

Hi there,

Once you’ve changed your nameservers and added an A record for your domain name to point to the Droplet’s IP address you could next setup an Nginx service as a reverse proxy for your Node.js app. You can follow the steps on how to do that here:

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04

That way you will be to visit your domain name directly via your browser rather than having to type the port that the Node.js service is running on.

Let me know how it goes!

Best,

Bobby