Report this

What is the reason for this report?

Forwarding IP:Port -> Registered Domain Name

Posted on November 9, 2018

Hello,

How does one forward IP:PORT to registered domain name? so instead of the IP:PORT appearing in the address bar, the registered domain name appears instead.



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!

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.

Hey friend!

This is a great question, and a fairly common concern. The first key is to move out of the mindset of forwarding it via DNS, which is what almost everyone thinks of first in the process. DNS is merely a name translated to IP, so 1.1.1.1:3000 after DNS = mydomain.com:3000, as DNS cannot mask a port.

(I’m using 1.1.1.1 as a sample IP address for this post)

The second key is to recognize how ports are masked by web browsers:

  1. https://mydomain.com = mydomain.com:443 = 1.1.1.1:443
  2. http://mydomain.com = mydomain.com:80 = 1.1.1.1:80

Web browsers mask ports 443 and 80 via https or http, as that value instructs the browser to connect on one of those two ports. So what you need to do is have your application served via port 443 (with SSL certificate) or port 80 (no SSL). One way to do this is to change your application configuration to make it listen on one of those ports. Another way is to use a reverse proxy. A reverse proxy takes in requests on port 80 or 443, pulls data from the other port, and serves it to the visitor over the common ports.

Here’s a tutorial for using Apache as a reverse proxy: https://www.digitalocean.com/community/tutorials/how-to-use-apache-as-a-reverse-proxy-with-mod_proxy-on-ubuntu-16-04

Jarland

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.