is traefik_dynamic.yaml usually needed? while I already have command: --trusted-origins docker.infra.zingastay.com
http:
serversTransports:
portainer-transport:
insecureSkipVerify: true
Is a traefik_dynamic.yaml file necessary when you already have command: --trusted-origins docker.infra.zingastay.com? The answer is yes, they serve different purposes. Here's a breakdown of why both are typically used.
Traefik configuration is split into two parts: static and dynamic.
- Static Configuration is defined in your
traefik.yamlfile. This configures Traefik's core settings at startup, such as entry points, log levels, and certificate resolvers. - Dynamic Configuration defines the rules for your services, including routers, services, and middlewares. It can be loaded from a file like
traefik_dynamic.yamlor directly from service labels, and it can be updated without restarting Traefik.
The serversTransports block you provided is part of Traefik's dynamic configuration. It is used to define how Traefik communicates with backend services. In your case, insecureSkipVerify: true is an instruction for Traefik to ignore TLS certificate validation when connecting to the portainer service. This is a common practice for internal communication where you trust the network.
The command: --trusted-origins docker.infra.zingastay.com flag is not a Traefik configuration at all. It is a command-line argument for the Portainer service. This flag is a security feature within Portainer itself, telling it to only allow API requests from the specified origin. It prevents cross-site request forgery (CSRF) attacks and other security vulnerabilities by ensuring that only trusted web clients can interact with the Portainer API.
You need both. The traefik_dynamic.yaml file (or equivalent configuration via labels in compose.yaml) is essential for Traefik to properly route traffic and manage TLS verification for its internal communication with backend services like Portainer. The --trusted-origins flag is a separate and necessary security measure for the Portainer application itself. They address two distinct concerns within your containerized environment.