Traefik. Redirections

question is posted here: docker - Traefik. Redirections - Stack Overflow

please, help

In general I would recommend to post all content here and also start with the question, not let people read 3 pages of config first before even knowing the question and what to look for.

Update Traefik to use a recent version, v2.3 is from 2020. When going to v3, Host() will only accept a single domain.

This is how simple Traefik example redirects:

    image: traefik/whoami:v1.10
      - proxy
      - traefik.enable=true
      - traefik.http.routers.mywhoami.rule=Host(``) || Host(``)

      - traefik.http.middlewares.mywwwredirect.redirectregex.regex=^https://www\.(.*)
      - traefik.http.middlewares.mywwwredirect.redirectregex.replacement=https://$${1}
      - traefik.http.routers.mywhoami.middlewares=mywwwredirect