#Help with simple domain name redirection registers

115 messages · Page 1 of 1 (latest)

lost trellis
#

Since aparently you can't reidrect a non cloudflare managed domain to a cloudflare managed domain, I added cloudflare for my domain

Using cloudflare's DNS registers for -, how can I redirect this domain so that it points to my domain when accessed through a browser, and a Minecraft server IP when accessed ingame?

Essentially, the root IP would be used as both a redirected website address, and an ingame server IP. Preferably without the use of any subdomains.

I tried setting up two A registries as shown in the image. For now it's not working, I also tried setting TTS to 1 minute just to make sure it's not a patience issue 😂 , so I likely didn't do it right yet.

You can redirect any host to any other host on the internet using 301 and 302 redirects. https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections

What you are likely doing when you say that you can't redirect to a Cloudflare managed domain is via DNS. You cannot redirect from one site to another using DNS. DNS redirects using CNAME records for the purpose of DNS resolution, which means if you point to Cloudflare it would result in Cloudflare IP's and a 1000 error: https://developers.cloudflare.com/support/troubleshooting/cloudflare-errors/troubleshooting-cloudflare-1xxx-errors/#error-1000-dns-points-to-prohibited-ip

URL redirection, also known as URL forwarding, is a technique to give more than one URL address to a page, a form, a whole website, or a web application. HTTP has a special kind of response, called a HTTP redirect, for this operation.

The errors described in this document might occur when visiting a website proxied by Cloudflare. For Cloudflare API or dashboard errors, review our …

#

I'm going to remove your original post @mild horizon as it exposes your origin IP and domain.

mild horizon
#

You can redirect any host to any other host on the internet using 301 and 302 redirects. @lost trellis Is this posible if I don't have a host for this dns? I thought the proper way to do this was through dns registers.
I'd have to pay for (or setup) a host just to also get mithcraft.es directed to mithrandircraft.es?

I'm attempting to do these two mithcraft.es redirections on cloudflare's DNS registers. My first try was through two A records.

#

You cannot redirect from one site to another using DNS
I can't do the following with the mithcraft.es dns?:
Essentially, the root IP would be used as both a redirected website address, and an ingame server IP. Preferably without the use of any subdomains.
But I actually managed to direct mithcraft.es to a Minecraft server IP, and it worked (on my OVH dns rules, as long as I'm not using cloudflare, for some reason using the same A register after managing this dns with cloudflare, it no longer works).

The only thing remaining was getting mithcraft.es redirected to mithrandicraft.es. The problem is the latter site uses cloudflare, and I'm afraid I can't disable it, for it's needed for some other services.

So I read you actually COULD direct to a cloudflare domain, as long as the directing domain was also under cloudflare, and this is what I was trying now. Also there's this article explaining that redirections should be done as I am doing: https://developers.cloudflare.com/fundamentals/setup/manage-domains/redirect-domain/

How does twitter do it's site redirection through the dns then? They have X.com domain (I even read this one was under cloudflare), which only sends you to twitter.com, are they paying for a host just to do that? They can't do it with a domain Register rule?

mild horizon
#

I could try doing this for my web redirection.

But even if it worked, It wouldn't solve my redirection to my MC server's IP not working on cloudflare's DNS registers while actually working on OVH's DNS registers.

#

Not to mention I'm not sure what the origin web server IP address is or where to find it.

mild horizon
#

Bump

rocky sedge
# mild horizon ```You can redirect any host to any other host on the internet using 301 and 302...

How does twitter do it's site redirection through the dns then? They have X.com domain (I even read this one was under cloudflare), which only sends you to twitter.com, are they paying for a host just to do that? They can't do it with a domain Register rule?
I don't understand what you mean by "domain register rule"
Twitter has a simple setup with Cloudflare, they have a proxied wildcard and apex record, like
AAAA @ 100:: Proxied
AAAA @ * Proxied
and then they have a page rule, dynamic/single redirect rule, or bulk redirect rule, like this page rule example:
*.x.com/*
Forwarding URL: https:// $1.twitter.com /$2`

#

Don't overthink it too much, Cloudflare is normally used as a CDN but can do a lot of "Host" things, with redirects, blocks, firewall rules, etc, plus you can use Pages/Workers/R2 to have CF be the actual host

mild horizon
#

How do set up my Cloudflare controlled domain mithcraft.es points to mithrandircraft.es website, but also 149.202.89.176 (a minecraft game server)?

rocky sedge
#

SRV Records for Minecraft would let you do that, I believe

mild horizon
#

I currently couldn't get it to point to any of both with Cloudflare. With OVH, using 2 A registers I managed to get mithcraft.es pointed to the server IP (actually working), and the website (with a cloudflare error) (because mithcraft.es wasn't under cloudflare)

mild horizon
rocky sedge
#

Something like:
Set up a unproxied subdomain,
A play minecraft-ipv4 unproxied
Set up a minecraft svr record
SRV @ _minecraft TCP Auto 0 0 25565 play.yoursite.com

Then have
AAAA @ 100:: Proxied
AAAA * 100:: Proxied
and a page rule redirect (like the one above) or one of the other redirect products

rocky sedge
mild horizon
#

subdomain I can't make the root domain point to both things? I managed to do it on OVH, same rules, but not on Cloudflare.

I understand it works diferent on Cloudflare, so maybe I'm forced to create a subdomain here?

rocky sedge
#

I don't think you managed to do it at OVH, not fully, or there's something else I don't understand about your setup, like if your gameserver also served your website.
But in my example above, players would still be able to just connect using yoursite.com, because of the SRV Record. Minecraft clients lookup the SRV Record, and then would resolve the play subdomain on their own. You just need it to be on the play subdomain because if it was on apex (root domain) it would A: never work with CF Proxy, B: even if it magically did, it would randomly pick one of the IPs to use

mild horizon
#

not fully the mc server worked perfectly
the website redirection returned an error, checking that error online revealed you can't point domain names to cloudflare controlled domains.

rocky sedge
#

What was your exact setup at OVH, what records, and what values

mild horizon
#

I don't think that round robin technique would block one redirection from the other right? More like it would try one and then the other.

rocky sedge
#

It's undefined behavior, not stipulated by any specific RFC as far as I know. They might (and some browsers do, I believe) try the other Record, but it's not the right way to do it, and it could take seconds for the page to load even if it does try, for the first record to time out

mild horizon
#

I don't mind these IP's being visible

#

well, they're no vital secret, although I suspect they could be used to circunvent cloudflare and actually send attacks (?)

rocky sedge
#

your game server's IP (the 149, I assume) will always be visible, and the CF one doesn't matter

mild horizon
#

Yes

mild horizon
# mild horizon Yes

And it worked, if I where to set the dns servers back to default on ovh, it would be working again (I presume)

rocky sedge
#

but yea, I guess it was as simple as two A records and you were just relying on retries. It's just not a winning plan, even if not for the randomness/unsupported behavior with retries and round robin DNS, Cloudflare won't allow you to do both unproxied and proxied records at the same time in their DNS (for the same hostname), and even if you did some hacky thing with CF for SaaS to get it working with a third party DNS, there's zero guarantee that CF won't change those IPs in the future and your hack will just stop working.
TLDR: You're doing undefined/unsupported things
try the suggestion above, and players would still be able to just connect via inputting your apex/root domain, via the magic of the srv record:
#1146540607523782666 message

mild horizon
#

what about whitelisting redirections to a cloudflare domain, is that posible?

#

I was excited about the prospect of a really short and rememberable IP 😂

#

So if I could avoid subdomaining...

rocky sedge
mild horizon
#

The issue with just using OVH is that you can't redirect a non cloudflare domain name to a cloudflare one.

rocky sedge
#

You mean how when you set it up with two A Records, you got a cloudflare error?

mild horizon
#

Yes.

#

And I read online that it's due to cloudflare limitations, so maybe I could just whitelist?

rocky sedge
#

That's not with OVH, but just because of the fact you're basically asking Cloudflare "hey, serve me a page for this website" and Cloudflare is like "this website isn't on Cloudflare, I don't have the SSL certs for it or any information on how to handle traffic for it"

mild horizon
#

Hm yeah, ok.

rocky sedge
#

The IP you added (188.114.96.5) isn't just assigned to your site. All CF Proxy IPs are shared, and rotate, websites are identified via host header/sni

#

I still don't get why the SRV Record solution wouldn't work fine for you though, players would be able to connect via mithcraft.es and the website would work on it as well

mild horizon
#

Ok, I will sacrifice the characters, and attempt at doing this properly through cloudflare, using a subdomain

rocky sedge
mild horizon
#

just characters.

#

more characters on the domain you must write

rocky sedge
#

what characters?

mild horizon
#

longer string.

#

the domain name characters.

rocky sedge
#

If you set up the SRV Record on your root, like said above, they wouldn't need to type in play.domain.com, they could just use the root domain (mithcraft.es)

mild horizon
#

it's obviously longer for a subdomain than for the root domain

#

oh.

#

ok then, let's do this 😄

#

I'm quite ignorant when it comes to webdev, that's why im here, thanks for your help

rocky sedge
#

Minecraft clients lookup the SRV Record, and then would resolve the play subdomain transparently. You just need the play subdomain to exist so that that resolution for the game server IP can take place, but players would connect via mithcraft.es, because the SRV record is there

mild horizon
#

For the first two instructions

#

Does this look good?

#

As for this...

#

What do you mean by *?

rocky sedge
#

ah opps I meant 100::

rocky sedge
#

If you want all subdomains to redirect & the root, you want both:
AAAA @ 100:: Proxied
AAAA * 100:: Proxied
If you just care about the root,
AAAA @ 100:: Proxied
(* is wildcard, matching all subdomains; @ is shorthand for your domain, mithcraft.es)

mild horizon
#

Ok...

#

As for this last bit, I don't understand:

#

Is this for the website redirect?

rocky sedge
#

(again if you don't want all subdomains, you can just do URL: mithcraft.es/* and https://mithrandircraft.es/$1)

#

oh and select status code 302/temp for status code, forgot to pick that

mild horizon
#

it's saved, but I'm not getting redirected, should it be working already?

rocky sedge
# mild horizon

opps, remove the first dot/period. I copied from an example for subdomains only
*mithcraft.es/*
https://$1mithrandircraft.es/$2

mild horizon
#

Everything works perfectly

#

you guys are absolute machines

#

thanks 😄

mild horizon
#

@rocky sedge
Hello, I have an issue with this setup. Since mithcraft.es is a SRV record, users can't use this IP to log in from minecraft bedrock edition (through the bedrock port 19132) (bedrock edition doesn't support SRV records afaik, and runs through UDP ports).

They can however login through play.mithrandircraft.es with the bedrock port (the other older and longer IP).

Not sure what the exact issue and solution might be, but I do have a SRV record setup for mithcraft.es as I am showing. It's also setup for TCP, and isn't bound to the bedrock port. This is all fine for Java edition, but not for bedrock edition.

rocky sedge
# mild horizon <@905865275583365161> Hello, I have an issue with this setup. Since `mithcraft....

I don't know that much about Bedrock but off a quick google search it looks like you're right and bedrock doesn't support srv records.
It's up to the application to do so. Nothing you can do if it doesn't.
The only "solution" would be to get the IP of your root site to work with bedrock/as a reverse proxy, which Cloudflare only offers with Spectrum Enterprise (which is probably out of reach. I have used it before when messing around with minecraft bedrock stuff though and it worked fine, it's just a magical reverse proxy in the Cloud)

#

otherwise you could have mithcraft.es be unproxied just pointing to your bedrock server, and then run a web server there to do the redirect (or forgo the redirect entirely)

mild horizon
#

I thought of switching mithcraft.es for mithrandircraft.es in terms of mithrandircraft.es being the srv record, and mithcraft.es the main dns.
But I'm willing to bet this will bring side issues with my website and shop, and I'm not sure I'll manage to do it properly without fing it up.

rocky sedge
#

You could have the srv record on both and have both work with Java

mild horizon
mild horizon
mild horizon
rocky sedge
rocky sedge
#

You can do whatever with them, they just need to point to an unproxied record pointing at your java server

#

You could create an exact copy of the one you have on mithcraft.es on mithrandircraft.es and it would just enable Java to connect via that domain as well

#

That's the beauty of them, independent from the web server used for that hostname and separately configured. Unlike Bedrock which is just looking up the A record for that hostname

mild horizon
#

Other ideas are,

#
  • I could just point mithcraft.es directly to the server's IPV4 without it being a SRV record... Just like play.mithrandircraft.es does, but I think I opened this because I attempted this with an A record and it failed for some reason.
#
  • Or if bedrock does support SRV records (which I doubt), maybe I can just create another parallel one on mithcraft.es with the bedrock port, and allowing UDP
#

One of these 2 could fix the issue of not being able to access through bedrock using this IP?

rocky sedge
#

It's just looking up the A record for that domain

#

mithcraft.es points at Cloudflare's proxy IPs, which won't work

mild horizon
rocky sedge
mild horizon
#

You could just point mithcraft.es unproxied at the Server IPv4
Yup, what should I change for this?

I also have this page rule which I believe made the redirection itself from mithcraft.es to mithrandircraft.es

#

and keep the srv record
Do I need to keep the srv record if I'm just pointing straight to the IPV4?
if you ran your java server on a different ip
I'd rather the IP was the same, just the port being different.

rocky sedge
#

Yup, what should I change for this?
Just the records for mithcraft.es, delete the AAAA, create an unproxied A record with your server IP.

I also have this page rule which I believe made the redirection itself from mithcraft.es to mithrandircraft.es
You can keep the page rule, but with it being unproxied it won't matter anymore
Do I need to keep the srv record if I'm just pointing straight to the IPV4?
You don't.
I'd rather the IP was the same, just the port being different.
Yea, I was just trying to clarify why it may be helpful to have both, Java would still use srv

mild horizon
#

You opened this because you wanted the redirect iirc
I don't see any reason why It should be a redirect to another dns. It can point straight to the IPV4.

#

You don't. It might cause issues with bedrock so I might try deleting it 🤷‍♂️

rocky sedge
mild horizon
#
  • Removed the previous SRV record that pointed to play.mithrandircraft.es in TCP through the java port.
  • Removed AAAA record.
  • Added A record pointing root to server IPV4.

Connection to the server with java and bedrock with both IP's (and their corresponding ports) is now possible.
This was my priority so I'm really thankful for your help 🙂

#

However, it's (obviously) no longer possible to access the website through mithcraft.es, any ideas on this? It would be cool if this were still possible, but it's not as important.

I noticed last time when mithcraft.es still pointed to mithrandircraft.es, you couldn't actually access the site with .www, would be amazing if it where accessible with both the prefixed (.www) and root only dns's.

rocky sedge
#

I noticed last time when mithcraft.es still pointed to mithrandircraft.es, you couldn't actually access the site with .www,
You can solve the www issue easily, if you kept the page rule it would already cover it, you just need to create
AAAA www 100:: Proxied

#

You could do that now even, wouldn't conflict

#

As for root, you'd have to run a web server on your game server which has a valid ssl cert like via Let's Encrypt/Certbot and responds with a redirect

mild horizon
#

huh it's detecting it here though.