ECS - rewrite the hostname of an FQDN

In the Traefik ECS provider, is there a way to rewrite the Host header using dockerLabels?

For example, If the request comes to https://abc.example.com, can I rewrite it to https://abc-123.example.com. In other words, I just want to append -123 to the hostname of the FQDN.

Hello @vikas027,

I would go with the redirect regexp middleware to do that.

With docker labels:

# Redirect with domain replacement
# Note: all dollar signs need to be doubled for escaping.
labels:
  - "traefik.http.middlewares.test-redirectregex.redirectregex.regex=^http://abc.example.com/(.*)"
  - "traefik.http.middlewares.test-redirectregex.redirectregex.replacement=http://abc-123.example.com/$${1}"

Hope it helps :smiley:

1 Like

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