Skip to main content

Migrating from TraefikEE to Traefik Proxy

· 2 min read
Stephan Hochdörfer
Head of IT Business Operations

Last month, while migrating our Traefik instance to our new Nomad cluster, I also made the switch from Traefik EE to Traefik Proxy. The transition went smoothly, but I had to make a few minor adjustments along the way.

While I could easily copy our main Traefik configuration, I had to make two minor adjustments in some of our Nomad jobs.

Identifiers of globally defined middlewares had to be changed

In TraefikEE, the global middleware identifiers - e.g., middlewares defined in our traefik.toml configuration file - used looked like this: my-ip-whitelist@traefikee. These had to be changed to my-ip-whitelist@file for Traefik Proxy.

The change was trivial, but since we had a few middlewares defined and used by quite a few Nomad jobs, it took a bit of time to make the changes.

HostRegexp expressions work slightly differently in Traefik Proxy

Traefik Proxy (v3) uses a new, Go-style regex syntax for matchers like HostRegexp, not the legacy v2 syntax that included named capturing groups like {subdomain:...}.

That means I to change the following v2 legacy rule syntax:

HostRegexp(`{subdomain:[a-z0-9\\-]+}.example.com`)"

To this new v3 syntax:

HostRegexp(`^[a-z0-9\\-]+\\.example\\.com`)"

And since the example\\.com domain name is configured via a Nomad variable in our Traefik Nomad job, I had to extend the syntax a bit to let Nomad properly escape the dot in the domain name to make it fully work:

HostRegexp(`^[a-z0-9\\-]+\\.${replace(var.domain, ".", "\\.")}`)"

After making the changes mentioned, all our Nomad workloads are running fine with our new Traefik Proxy setup.