0

I have the following setup:

  • a registered domain, domain1.com, with several websites/webapps under different subdomains: sub1.domain1.com, sub2.domain1.com etc.
  • on my LAN I have a pfsense router and
  • a Nginx Proxy Manager(npm) which maps each website/webapp to its correct ip/port on the lan network.

What I would like to do:

  • to be able to create an alias for domain1.com, let's say domain2.lan (visible only from the LAN),
  • so I could be able to access sub1.domain1.com at the address sub1.domain2.lan
  • to avoid duplicating all the settings in npm for domain2.lan
  • also to be able to add other subdomains for services that I only expose to the LAN network, like localsub1.domain2.lan

Initially I thought that a split-brain dns (which I already have configured and working in pfsense) would help, but it actually it isn't a solution because in the Host Overrides settings you can only specify an IP, not another domain.

Also I thought I might use Domain Overrides in pfsense's Domain Resolver, but I also arrived at the conclusion that it is not the right tool, as this actually allows for an override to the DNS server that looks up for the domain you specify.

So, I want to ask if there is a kind of elegant solution to this (which avoids duplicating settings in multiple places).

1 Answers1

0

Create a DNAME record at domain2.lan, pointing to the target domain.

domain2.lan. DNAME domain1.com.

It works a bit like CNAME, but instead of aliasing the domain itself, it generates CNAMEs for any subdomains that are queried.

pfSense's resolver is Unbound (or at least was the last time I checked) and it should allow you to configure any record types as local overrides. If there's no way to create a DNAME through GUI, add local-data: directly to unbound.conf.

user1686
  • 8,717
  • 25
  • 38
  • But the reverse proxy is still going to need to be updated to direct traffic that arrives with a `Host: foo.domain2.lan` to `foo.comain1.com` because it's going to be routing based on server name. – hardillb Jun 30 '22 at 20:57