How to

How to Use a Custom Domain for a Game Server (A and SRV Records)

Point play.yourdomain.com at a game server with an A record, hide the port with an SRV record for Minecraft, and avoid the Cloudflare proxy mistake.

Updated Oct 7, 2026 · 5 min read

On this page

To use your own domain for a game server, add an A record (for example play) that points to the server's IP address in your domain's DNS settings. Players then join with play.yourdomain.com:port. For Minecraft Java Edition you can also add an SRV record, which hides the port so players type only play.yourdomain.com. If your DNS is on Cloudflare, the record must be set to DNS only (grey cloud), because Cloudflare's proxy does not pass game traffic.

What you need

  • A domain you own, from any registrar.
  • Access to its DNS settings (at the registrar, or Cloudflare if you moved DNS there).
  • Your server's IP and port, from your host's control panel.

The examples below use the documentation IP 203.0.113.10 and port 27412. Replace them with yours.

Step 1: add an A record

An A record maps a name to an IP address.

  1. Open your domain's DNS settings.
  2. Add a new record:
Field Value
Type A
Name play
Value / Points to 203.0.113.10
TTL Auto, or 300 seconds
Proxy (Cloudflare only) DNS only, grey cloud
  1. Save.

Now play.yourdomain.com points at your server's IP. Players join with play.yourdomain.com:27412.

If the host gives you a hostname instead of an IP, use a CNAME record pointing play to that hostname. You cannot put a CNAME on the bare domain (yourdomain.com) at most providers, so use a subdomain.

Step 2 (Minecraft Java): add an SRV record to hide the port

Minecraft Java looks up an SRV record named _minecraft._tcp before connecting. If it finds one, it uses the port from the record, so players never type it.

Add a record:

Field Value
Type SRV
Service _minecraft
Protocol _tcp
Name play
Priority 0
Weight 5
Port 27412
Target play.yourdomain.com

Some providers want the whole name in one field instead: _minecraft._tcp.play. The target must be a hostname with an A record, not an IP address, which is why you add the A record first.

Players can now join with just play.yourdomain.com.

Which games read SRV records

Game A record works SRV hides the port
Minecraft Java Yes Yes
Minecraft Bedrock Yes No, players type the port
Most games with a direct connect box (Valheim, Terraria, Palworld) Usually No
Games joined with a console command (Rust, CS2) Usually, connect play.yourdomain.com:27412 No
Games joined only through a server browser Not needed No

"Usually" because each game resolves names its own way. Test with your game before announcing the domain. If a game refuses a hostname, give players the IP and port instead.

For games other than Minecraft Java, the only way to drop the port is a server on the default port, which normally needs a dedicated IP. See dedicated IP vs shared IP.

Step 3: wait and test

DNS changes usually show up within minutes, but can take longer depending on the old TTL.

Check the A record from a terminal:

nslookup play.yourdomain.com

Check the SRV record:

nslookup -type=SRV _minecraft._tcp.play.yourdomain.com

On Mac or Linux you can use dig:

dig +short play.yourdomain.com
dig +short SRV _minecraft._tcp.play.yourdomain.com

The SRV answer should show 0 5 27412 play.yourdomain.com. If it does, try joining from the game.

Common mistakes

The Cloudflare orange cloud

With proxy on (orange cloud), Cloudflare answers with its own IP and only forwards web traffic. Game connections time out. Set the A record to DNS only. Cloudflare does not proxy SRV records, but the A record they point to must be DNS only too.

Putting the IP in the SRV target

The target must be a hostname. An IP in the target field either gets rejected or silently fails.

Double names

Some DNS panels add your domain automatically. If you type play.yourdomain.com in the Name field, you get play.yourdomain.com.yourdomain.com. Type only play.

Wrong port in the SRV record

The SRV port must be the server's real port from your control panel, not 25565.

The IP changed

If your host moves your server and the IP changes, update the A record. Everything else follows.

Using the domain in server.properties

Leave server-ip empty in Minecraft's server.properties. The domain is for players; the server does not need to know it. Our guide on finding your Minecraft server IP explains that setting.

Free subdomains vs your own domain

Some hosts include a free subdomain on their own domain. It is handy, but it disappears if you leave the host. Your own domain costs a small yearly fee at any registrar and stays with you, so you can move to a new host and keep the same address by updating one record.

Using it with GamezServers

Copy the address from the top of your control panel: the part before the colon is the IP for your A record, and the number after is the port for your SRV record. Extra ports a game uses, such as Minecraft's voice chat and web map ports, are listed under the address. If you are starting a community, an address like play.yourname.com looks better in Discord, and our guide to running a game server for a Discord server covers the rest. Need a server first? Start with Minecraft or any other game.

A Minecraft Java server world with a large build

FAQ

Can I use a domain for my Minecraft server without the port?

Yes, for Java Edition. Add an A record and an SRV record named _minecraft._tcp with your server's port. Bedrock players still need to type the port.

Why does my domain not work for my game server?

The most common causes are the Cloudflare proxy being on, an IP in the SRV target field, or the record not having propagated yet. Check with nslookup.

Do I need to pay for a domain?

You need to own the domain, which costs a yearly fee at a registrar. The DNS records themselves are free.

Will a domain make my server faster?

No. It only changes the name players type. The connection goes to the same IP.

Want a server without the setup?

From75¢

Pick a game, pay, play. Live the moment checkout finishes.

Keep reading