Managing Multiple Domains in Traefik - Best Practices

Hi Traefik swarm!

I have a scenario where I need to handle 200 different domains using Traefik. While configuring the routers, I'm wondering what the best approach would be. Should I create 200 separate HTTP routers, each with a rule matching a single hostname, or would it be more efficient to have a single HTTP router with a real long rule containing all the domains?

To provide some context, I'll be dynamically generating the configuration using a REST call. Considering this, I'm curious to know your opinions on which approach you would prefer and any potential best practices you could share.

Have any of you encountered a similar situation before? If so, what approach did you take and why? Are there any performance considerations or potential pitfalls I should be aware of?

I'm excited to hear your thoughts and experiences on this matter!

Looking forward to your insights!


How do you generate the config with REST? Use provider.http?

If you only have a single Traefik instance, I would create a "dynamic" file per domain. That way if something goes wrong the others are not affected.

If you have a long line of Host() and a domain fails LE validation, I think the whole router fails TLS.

Hi @bluepuma77,

exactly I'm currently using provider.http on two Traefik instances and load configuration from central place.

Instead of generating a configuration file with multiple routers per domain (3 routers x 200 domains = 600 http routers), I'm considering using total of three routers with a long list of Host() directives. Just for optimization...

Thank you for pointing out the potential issues with Let's Encrypt and TLS. Didn't thought about it... In this case the "overloaded" config attempt might be better.

Any one else have some helpful input?