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.
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.