How do I redirect traffic only if being accessed from a specific port?
My website, https://coolkids.gq, has a Minecraft server hosted on it as well as a web server. It hosts both Bedrock and Java versions of Minecraft (unrelated) and I’ve figured out how to do the Java side but I’m still stuck on the bedrock side as it doesn’t allow SRV records.
I want to be able to access both the webpage and the Minecraft server at https://coolkids.gq
. The Minecraft server uses port 19132 and the website uses ports 80 and 443 obviously.
When I go to HTTP or HTTPS ports it should take me to the main website, but when I use 19132 it will redirect me to another link that hosts the server, e.g. myamazingserver.net
. It would be preferred if it redirected to myamazingserver.net:19132
but just myamazingserver.net
should work as well.
How, by using .htaccess, HTML, PHP or DNS could I achieve this?
Edit: Bedrock Edition does not support SRV.
Although Patrick is correct in saying that web browsers do not support SRV
records, Minecraft does support them, so there's no need for a reverse proxy setup.
According to this NameCheap tutorial, you'll need to create an SRV
record with the following info:
Service: _minecraft
Protocol: _tcp
Priority: 0
Weight: 5
Port: [custom port]
Target: [your domain]
The record needed for other domain registrars should be very similar.
After this is set up, you'll still be able to access your website at https://coolkids.gq
, but you'll also be able to access your Minecraft server at coolkids.gq
(note the lack of https://
since Minecraft afaik has no URI scheme).
Comments
Post a Comment