Score:0

Redirecting a subdomain to a different IP

tr flag

This question was originally posted on the Network Engineering StackExchange page, but has been moved here.

TL;DR I have a domain name attached to an AWS Elastic IP, I'd like to create a record for a subdomain that redirects to a completely different IP.

Hello, currently I'm making a website as a personal project. My setup is currently an AWS EC2 instance running RHEL, with an elastic IP associated with it. At the moment, I just have apache HTTPd installed with a proof-of-concept index.html (eventually plan to switch to Tomcat).

I've also registered a domain name via AWS Route 53, and successfully created a record for the main website. I.e, navigating to my domain correctly shows my website. Now, unrelated to the AWS services, I host a PLEX server on my own network (PLEX is media server). You can access this PLEX server directly by navigating to my own personal IP address (not recommended, but for testing purposes at the moment). I've modified my router's firewall to redirect all incoming data from port 80 to the specific PLEX port I have. In other words, by navigating to my IP directly in a browser, the PLEX server loads up.

When I try to create a record for a subdomain (in my example, the subdomain would be watch.mydomain.name, where watch is the subdomain), the page never loads (Connection timed out). I don't think it's an issue with the PLEX server, but rather how my EC2 is handling redirects. I'm curious if SSL is at play as well, since when trying to navigate to the subdomain, it automatically attempts https. Note, the main website does have a certificate, though it's self signed. This means the main domain can be connected with https. I tried creating an A record, similar to the one for my EC2 IP, but with my personal IP. I've tried various ports, but redirecting 80 -> the plex port seems to make the most sense. I'm at a lost for solutions, and not sure who/where these possible errors would be logged.

Thank you for any advice or solutions. Please let me know if you need any more information.

Score:1
cn flag

If Route53 manages your domain, just create an A record pointing to your IP. It will all work as intended.

Example:

screenshot of example

EDIT: Apologies - I missed your last paragraph. Creating an A record should definitely work, although you might need time for your DNS cache to update. If it's not working then you need to debug the various links in the chain, from resolving DNS on your client, to the local router, to the server, iptables, etc etc.

You'll need to explicitly set HTTP in your browser to use it nowadays as most seem to assume HTTPS. If that works with your route forwarding port 80 to the Plex server, then you can attempt to add HTTPS in to the mix. I'd recommend not logging in via HTTP though ;-)

tr flag
thank you so much for the quick response! I modified firefox to not force https, and wouldn't you believe it, I was able to connect to the PLEX server remotely through the subdomain! An excellent start, this surely means some SSL configuring, but the functionality is there. Thank you so much for pointing me in the right direction.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.