Minecraft – Unable to Join Minecraft Server I Host When Using Domain Name, but can Still Join When Using the IP

hostingminecraft-java-editionminecraft-java-edition-servernetworking

Issue/Background

I host a Minecraft server from a home machine. Recently I decided to open it up to the public, but to protect my private IP address (and to give the server a static IP) I set up a proxy for free by using SSLH on an AWS EC2 instance.

I allocated an Elastic IP to the instance, acquired a domain name, and registered my Elastic IP to the domain.

When I try to join the server with the domain name, specifying port 55565, I am unable to connect. I am however able to connect just fine when I join with the Elastic IP and port.

I am at a loss for what could be causing the problem here, but I am certainly overlooking some critical detail. Any suggestions as to what I might try next would be thoroughly appreciated.

What I've Tried

Thinking the issue could be with the nameservers not resolving the requests appropriately, I switched to Clooudflare nameservers (making sure to set the proxy status within Cloudflare to "DNS Only"). Didn't work.

Still thinking the issue was with domain resolution, I set an SRV Record in Cloudflare so I shouldn't even have to type out the port. Still didn't work.

Thinking the issue could have to do with AWS, I set the security group's inbound rules to accept inbound traffic of any type on any port. Still can't connect, but hey I can ping it so that's cool. (reverted this rule after testing)

Other Info

Not sure what else to include honestly. I'm still a bit of a beginner when it comes to this sorta thing. The DNS records that are listed for the domain are the A record and the SRV record.

I'm starting to thing the issue could be with the AWS instance. The configuration for SSLH looks like this

# This is a basic configuration file that should provide
# sensible values for "standard" setup.

verbose: false;
foreground: true;
inetd: false;
numeric: false;
transparent: false;
timeout: 2;
user: "sslh";

# Change hostname with your external address name.
listen:
(
    { host: "0.0.0.0"; port: "25565"; }
);

protocols:
(
    # { name: "ssh"; service: "ssh"; host: "localhost"; port: "22"; fork: true; },
    # { name: "openvpn"; host: "localhost"; port: "1194"; },
    # { name: "xmpp"; host: "localhost"; port: "5222"; },
    # { name: "http"; host: "localhost"; port: "80"; },
    # { name: "ssl"; host: "localhost"; port: "443"; log_level: 0; },
     { name: "anyprot"; host: "MY_PRIVATE_IP"; port: "25565"; }
);

Best Answer

Ok I think I got this sorted now, but I'll post the answer in case anyone else is struggling similarly!

I found this guide from AWS about routing traffic to an EC2 instance. It looked promising, but I was really confused when it came to setting up the routing policy as there were some options I was unfamiliar with.

After changing the name servers to AWS with the domain registrar, you have to make a simple routing record to route traffic to the elastic IP of the instance. The routing type A should be all you need. No need for SRV records I think, though that may just be because of the way I have set up SSLH. I honestly don't know.

Remember that adding/modifying routing records takes time to propagate to all the name servers because of caching rules and such. So if you do this you need to wait a few minutes to see the results.

If anyone with more insight would like to chime in, please feel free, but for now I'm marking this as the answer.