HostRegexp - can´t get it work

I still struggle to get HostRegexp working.

I use this normally in Labels:

    - "traefik.http.routers.topnotch.rule=Host(`domain1.com`) || Host(`domain2.com`) || Host(`www.domain1.com`) || Host(`www.domain2.com`)"

I wanna make it more general and avoid writing domains twice, so i search and found some examples, but - they dont work:

    - "traefik.http.routers.topnotch.rule=HostRegexp(`{worldwideweb:(www\.)?}domain1.com`) || HostRegexp(`{worldwideweb:(www\.)?}domain2.com`)"

Always get from Docker: "found unknown escape character"

What i am doing wrong? Lates V2 Traeffik, Latest docker.

Appreciate any help/hint to get this solved.

In labels, you might need to escape twice, try something like

- "traefik.http.routers.my-router.rule=HostRegexp(`{host:(www\\.)?}domain\\.com`)"

Thank you so much. OMG. So simple - so easy.

Solved my problem now. Amazing. Thx again.

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