0

I have a VM running on a GCP. With TCP 0.0.0.0:26657 and 0.0.0.0:1317 exposed using firewall rules, I can access them as http://external_ip:26657 and http://external_ip:1317.

Since they are HTTP I couldn't use them on my HTTPS site where I get

net::ERR_SSL_PROTOCOL_ERROR

How do I add an SSL certificate from a DNS provider and expose the ports to the created domain?

I can however add the DNS for the external IP but I am unable to access ports. ex: mydomain.com:26657

I appreciate any help you can provide.

Logesh R
  • 13
  • 3
  • Domain names don't refer to specific ports. They just refer to IP addresses. The client can look up a hostname to get the IP address which the client should connect to, but the client has to figure out the port without the help of DNS. Port 80 is just the default port for HTTP service. From this thread: https://stackoverflow.com/questions/25971399/create-a-domain-name-pointing-to-an-ip-of-port-different-than-80 – James S Oct 28 '22 at 06:32

1 Answers1

1

There is no way to specify port numbers in DNS. If you are running a website, your server must respond to HTTPS request on port 443 if you are to use an SSL certificate. DNS names will only refer to IP addresses and has no concept of ports for older protocols such as HTTP, HTTPS and SSL.

If you are looking to run multiple sites on the same server, then you'll need to configure virtual hosts for it to happen. Have the A record pointed to the IP address of the VM and the virtual host file should take care of managing the port where the server should operate on.

You may come across SRV records which will allow you to specify port numbers in the DNS. However, this feature only works with newer protocols that specifically do SRV lookups which means that HTTP and HTTPS will continue to use their current port numbers and won't work with SRV.

James S
  • 1,181
  • 1
  • 7