Add subdomain to haproxy
-
Hi,
For hosting Domoticz as a web app, I have haproxy/acme running on my pfSense router/firewall for a while now.
FrontEnd Type: http/https offloadingIt took me quitte some time to make it work because this is not my core business.
Next phase is that I want to add a subdomain pointing to a different host (node-red) in my network.
Before I start, I need to know some info:-
Do I need a second certificate, or is the certificate I have running on ACME and using for the domain also valid for the subdomain?
-
Do I only need to create a second backend, or do I need a second frontend as well?
-
I have cloudflare dns pointing to my namecheap domain. When i create a subdomain, do I need to create a CNAME or an A record?
Maybe someone can help me out here?
-
-
@gschmidt said in Add subdomain to haproxy:
Do I need a second certificate
Yes, unless you have a wildcard certificate included.
Do I only need to create a second backend, or do I need a second frontend as well?
You need a backend for each internal server you want to forward traffic to. So yes.
But you have to do it with a single common frontend or even a shared frontend. You have to add an additional ACL for the subdomain and use this to forward it to the additional backend.I have cloudflare dns pointing to my namecheap domain. When i create a subdomain, do I need to create a CNAME or an A record?
I don't know, how to set it up on Cloudflare, but basically both is possible. However, configuring a CNAME and point it to the primary domain name might be smarter. This way you don't need to add an additional dynamic DNS client to pfSense.
-
Thanx got it working!
I have updated my certificate to a wild card certificate which makes it much easier to set it up.
The CNAME for the subdomain is working
Created a backend and updated the frontend by adding a second ACL to the subdomain and an action pointing to the new backend. -
One last question
How and where (frontend/backend) do I setup a host that has a webserver located in a subdirectory? e.g. 192.168.1.51:1880/ui -
@gschmidt
In the frontend. You have to add an ACL for it with expression e.g. "Path starts with" and enter "ui" for the value.
And then add an action to direct it the the desired server.