0

About to set up a lab environment with HAproxy for test purposes. HAproxy will load-balance (round robin) two web servers (Apache), running two virtual hosts on each server. Site A will be hosted on both server 1 and server 2 and the same for Site B.

My question regards the DNS configuration.

Can I create an A record for the load balancer, and one CNAME record for each website and point them to the load balancers? Assuming that the virtual hosts servernames are the same on both servers.

Or do I need to create two subdomains with two A records in each subdomain. The A records will point Site A and B to one of the two web servers in each subdomain. Example below.

Example A SiteA.server1.domain.local A SiteB.server1.domain.local
A SiteA.server2.domain.local A SiteB.server2.domain.local

Then create an A record in the parent domain for the load balancer, and two CNAME records pointing one of the Site A & B to the load balancer.

Which would work?

2
  • DNS wise both your cases should work (but remember that you can't have CNAME at apex, so it can be used only for www) even if your example is not clear/poorly formatted (it doesn't show any A records - with IP addresses - and please remember about IPv6 ! - nor CNAME records). Also your question may be offtopic as too broad/vague and not really in a business kind of setup. Separately, what prohibits you from testing the 2 hypothesis and just see which one gives you the better outcomes based on your constraints? Commented Aug 3, 2022 at 15:56
  • Don't have access to the equipment until Thursday. Will try out both solutions then. No CNAME for apex, CNAME will point to the load balancers A record. Commented Aug 3, 2022 at 16:42

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.