I'm setting up Traefik (version 3.6) on my homelab Raspberry Pi server, and wanted to point a couple of different domains at a placeholder web server. As I use those domains, I'll split them off to point at other services, but most of the time they're essentially parked.
All of this is running in Docker compose. I'm new to Traefik -- I'm in the process of migrating from an old NGINX-based setup that's always been overly complicated.
Everything I was seeing online said I could just add this comma-separated label to the placeholder service:
labels:
- "traefik.http.routers.foobar.rule=Host(`www.foo.com`,`www.bar.com`)"
That may have worked for Traefik 2, but in Traefik 3 that throws an error in the dashboard and the service is disabled. The error doesn't really say exactly what's wrong, unfortunately, just that the rule is invalid.
This worked though:
labels:
- "traefik.http.routers.foobar.rule=Host(`www.foo.com`) || Host(`www.bar.com`)"
So instead of comma-separated, you use multiple `Host` rules with boolean "or" pipes. Probably more flexible this way since you could also use other logical operators, but it seems this detail isn't well documented, or at least I didn't come across it in the many things I read trying to fix it.