Just migrated to Traefik version 3.1.1. I'm using, Docker, Docker compose, a couple of websites and nothing fancy in the config. At Traefik startup I got this error:
ERR error="error while adding rule Host(`domain.nl`,`www.domain.nl`,`domain2.nl`,`www.domain2.nl`): error while adding rule Host: unexpected number of parameters; got 4, expected one of [1]" entryPointName=web routerName=domainnl@docker`
Googled it and found enough hits, so changed my code to:
Just to be sure I enclose one of the site configs:
version: "3"
services:
domain.io:
container_name: domain.io
image: nginx
restart: unless-stopped
volumes:
- ./data:/var/www/html
- ./nginx.conf:/etc/nginx/conf.d/default.conf
- /etc/localtime:/etc/localtime:ro
networks:
- traefik
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
labels:
# Enable because disabled by default in traefik.yml
- "traefik.enable=true"
# Always redirect to https
- "traefik.http.middlewares.redirect.redirectscheme.scheme=https"
- "traefik.http.middlewares.redirect.redirectscheme.permanent=true"
# Http section
- "traefik.http.routers.domainio.rule=Host(`domain.io`) || Host(`www.domain.io`)"
- "traefik.http.routers.domainio.entrypoints=web"
- "traefik.http.routers.domainio.middlewares=redirect"
# Https section
- "traefik.http.routers.domainio-secure.rule=Host(`domain.io`) || Host(`www.domain.io`)"
- "traefik.http.routers.domainio-secure.entrypoints=websecure"
# Connect middelwares to router
- "traefik.http.routers.domainio-secure.middlewares=compression"
# All secure middlewares go here
- "traefik.http.middlewares.compression.compress=true"
# TLS configuration to be used
- "traefik.http.routers.domainio-secure.tls=true"
- "traefik.http.routers.domainio-secure.tls.certresolver=letsencrypt"
networks:
traefik:
external: true
It's been quite a while that I set this up initially, but I believe this is all config. I also replaced the acme.json already, and let Traefik re-populate that file.
When this is solved I will surely look at your centralization tip! Thanks!
I had already restarted containers, restarted the VPS, cleared docker caches and cleaned the acme.json (just to be sure).
Your question made me look at the container labels though and surprise surprise: it had the old ones. So I actually had to delete container and spin up a fresh one (i thought a docker compose down and docker compuse up -d would do the same, but it didn't).