Search code examples
dnssubdomainreverse-proxytraefik

What is needed to run Traefik main reverse-proxy under a subdomain?


I have successfully setup Traefik under a top-level domain such as example.com, which is used as a main reverse proxy in docker-swarm with multiple containers/stacks. This way, I could automatically point traefik to subdomains received from docker containerized services, e.g. service1.example.com, service2.example.com etc.

My question is, would such a setup also work if I run traefik in a subdomain, e.g. app.example.com, where example.com is hosted on a completely separate server not managed by traefik? I want my containers to be reachable similarly in those subdomains, e.g. service1.app.example.com, service2.app.example.com, wherein subdomains (service1, service2) are managed by traefik running at app.example.com.

I know that I needed a DNS A record to point to my traefik-instance in example 1, can I do something similar with a subdomain or would this work differently?

Many thanks for hints!


Solution

  • This will work without a problem, as long as your domain provider doesn't restrict this.

    You will have an A record with *.app and point it to the Traefik server ip