How traefik resolve hostnames

Hi,

I'm curious to learn more about how Traefik deals with figuring out hostnames and how it all works.

For instance, in Nginx, all hostnames are typically resolved during startup. If you aim to accommodate dynamic hostnames with potentially changing IP addresses, you'd need to define them as variables, alongside the ability to set resolve cache times.

  1. Does Traefik resolve all hostnames (URLs in the servers section) during startup?
  2. Does Traefik resolve hostnames with each request? Or does it cache results and utilize the cache until encountering an error, after which it attempts resolution again?

Usually DNS entries have a TTL (time-to-live). Domains will be resolved, they will be cached until TTL is over, then they are resolved again.

Thank you for your answer.

What happens if the IP address of domain(hostname) change before TTL ends? does Traefik return 502 Bad Gateway or No, try to resolve it first and then return error if couldn't resolve it?