I have a very technical question regarding dns proxied in cloudflare.
I have a domain in cloudflare and have two subdomains say test1 and test2.
test1 subdomain has content 126.96.36.199 and proxied.
test2 subdomain has content 321.321.321.321 and proxied.
When I test to what IP address these subdomains are resolving to, both are resolving to cloudflare server’s IP address, in my case, its 188.8.131.52.
My question is,
Once my computer receives the cloudflare IP address as IP address for both subdomains, it sends next TCP packet that contains cloudflare server IP address as destination IP address. When both packets targetting different servers arrives at cloudflare’s server, how will it differentiate that one should go to test1 subdomain and another one should go to test2 subdomain?
A side note: As per my understading, the TCP packet (let’s say its a HTTP protocol) doesn’t contain any other place to put multiple destinations in a packet, that’s even not making sense to me. Am I missing any obvious part in this entire thing of how this proxied dns records works?
Thanks for the warm Welcome and your quick response for my question.
What I understood from your response is Cloudflare ends the SSL (if it’s https) and check for the Host header and forwards packet to that server through its internal network.
Another question popping in my mind immediately, I should not enable proxy on my domain (or subdomains) if I want to use other protocols like SSH, FTP, SMTP, or so?
In the first place when a DNS query happens, the cloudflare nameservers has no clue on what’s the application protocol is. Right?
Correct. Cloudflare is for proxying HTTP/S traffic over specific ports. If you want other services, you’ll either have to use Spectrum, or not proxy that hostname. (or Tunnels, but that’s a whole 'nother topic)