I want to connect domain to ip port

Hello :wave:
I have a domain and a website on VDS. My site works at ip:3000. I logged in to the domain company as “nameserver”. The issue I want help with is redirecting this domain to IP:3000. I wonder how can I do it?

Assuming the traffic is HTTP/HTTPS and your DNS record is proxied, you can use origin rules to tell Cloudflare to connect to your origin on port 3000. You will use your domain without adding a port in the browser.


First of all, thank you for your help!
I reviewed the source you posted, but I’m a bit of a novice… Is there any chance you can explain how to add it? As you said, all I want is to direct the https/ip:3000 address to my domain :slight_smile:

To save time, just to confirm, what do you want to do (as I’m not sure from your title and posts)…

  1. Enter and redirect to https://example.com (users will see https://example.com in the browser address bar)


  1. Enter https://example.com and redirect to (users will see in the browser address bar).


  1. Enter https://example.com and have it show the content of what you host at on port 3000 (users will see https://example.com in the browser address bar).
1 Like

I’m sorry if I caused any confusion. I think 1…

Users will enter https://example.com and will be directed to https://example.com will appear in the address bar. (thanks)


That’s #3.
(#1 can’t be done on Cloudflare, only on your origin as it is your IP address that the request needs to go to)

Assuming it is #3 you want, then you need to…

Set a DNS A record for @ (will show as example.com after saving) that is proxied and set to your server IP address.

Go to origin rules here…

…and set up like this…

Ensure always use HTTPS is set here…

Make sure you have a valid SSL certificate on your origin and set SSL/TLS to “Full (strict)” here…


Thank you… Really… :slight_smile:
I’ve been researching for a day, thanks to you I understood the problem and my mistake. I’m a bit of a newbie so forgive me if I misled you. Thank you very much for your detailed, step-by-step explanation.
However, when you set SSL/TLS to “Full (strict)” or “Full”, the site does not open. It turns on when I set it to “Flexible”. I don’t know if it will cause any problems, but I managed to get it to work as I described. So I wanted to try and say thank you.

1 Like

You can achieve this with Cloudflare Tunnels.

  1. On your VDS you will run cloudflared, which establishes a connection outbound from your VDS to Cloudflare.
  2. You will make a new Public Hostname for your tunnel and this will instruct all traffic that reaches Cloudflare on https://www.example.com will be sent to your VDS and when it reaches your VDS, the Cloudflare daemon will forward the traffic to the IP and port you suggested. The config looks like this:

Follow the instructions here for more details on setting up a tunnel.

Also, if you get stuck, search for cloudflare tunnel on youtube and there are quite a number of great tutorials in the last year on how to do this step by step. I use this exact set up every day and it works great and is super easy.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.