Multiple Containers, One Public IP, HaProxy. How to Cname properly?

I have HAProxy working well with pfSense. I have multiple Back End “Different Domain Name Websites.”

My question is how to use proper Cname records with my hosting provider with “one website to many hostnames each with a different lxc containers?”

I was figuring on the following setup below since HAProxy could do its thing but I’ve read several
different opinions regarding DNS extra calls and time to resolve if I cname to one IP.





Then HAProxy would simply forward that public SNI to the correct backend.

Or Do I make an A record with the public IP for each Cname?



Working with CNAME records


MX and NS records can't point to a CNAME record; they must point to an A record (for IPv4) or an AAAA record (for IPv6).
The CNAME **chain length should not be greater than 5.**

The CNAME can’t share the same name as another record type for a single domain.
You can't have multiple CNAME records with the same name in the same domain.

Valid CNAME record examples: 900 IN CNAME 900 IN CNAME

How CNAME records work

A CNAME is an alias. It allows one domain to point to another domain which, if you follow the CNAME chain, eventually resolves to an A record and IP address. Pointing a CNAME record to another CNAME record is inefficient (but possible) because it requires multiple DNS lookups before the domain can be loaded, negatively impacting the speed of the user experience.

Each resource record in the CNAME chain is considered as a separate DNS query, which slows down the resolution time.

For example, use CNAME records to point and to the DNS entry for, which in turn has an A record that points to the IP address: CNAME A


** :thinking:**

CNAME Flattening

The above video may help if you manage outside clients’ CNAMES.
Not In my specific case so I just created
A Records directly after all and cut to the chase! :rofl:
Created some test HAProxy backends with the correct local ips and viola bam!!!
LOADS FAST BABY from an outside private browser.



By the way I also manage multiple domains with Google Domains and they do not have CNAME Flattening plus there is no way to bulk update domains. What a PITA. I was able to use EPIK for a test domain and I can simply upload my dns info and create 200 A records in 2 minutes!

This works for me. Now I can add another IP A record for Dual WAN connection hopefully.