Host rule does not support multiple hostnames anymore

Hey everyone :wave:

I think I've found a regression while playing around with RC 1. Previously (in version 2.11 for example) it was possible to add multiple Host names to the Host-Rule but not anymore in 3.0:

error while adding rule Host(host1.example.com,host2.example.com,host3.random.com): error while adding rule Host: unexpected number of parameters; got 3, expected one of [1]

  nginx:
    image: nginx
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.web.rule=Host(`host1.example.com`, `host2.example.com`, `host3.random.com`)"
      - "traefik.http.routers.web.entryPoints=websecure"
      - "traefik.http.routers.web.tls=true"
      - "traefik.http.services.web.loadbalancer.server.scheme=https"
      - "traefik.http.services.web.loadbalancer.server.port=443"
    networks:
      - traefik

The only way to accomplish something like this with Traefik 3.0 RC1 would be, to use the HostRegexp-Rule.

Was this changed intentionally and just needs mentioning in the migration guide or was this change unintentional and should be fixed?

It’s in there, but not very explicit:

All matchers now take a single value (except Header , HeaderRegexp , Query , and QueryRegexp which take two) and should be explicitly combined using logical operators to mimic previous behavior.

1 Like

Ahh thanks, I must have missed that :+1:

 nginx:
    image: nginx
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.web.rule=Host(`host1.example.com`) || Host(`host2.example.com`) || Host(`host3.random.com`)"
      - "traefik.http.routers.web.entryPoints=websecure"
      - "traefik.http.routers.web.tls=true"
      - "traefik.http.services.web.loadbalancer.server.scheme=https"
      - "traefik.http.services.web.loadbalancer.server.port=443"
    networks:
      - traefik
3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.