Rewrite Header

Rewrite header is a middleware plugin for Traefik which replace a header in the response

Configuration

Static

pilot:
  token: "xxxx"

experimental:
  plugins:
    rewriteHeaders:
      modulename: "github.com/XciD/traefik-plugin-rewrite-headers"
      version: "v0.0.1"

Dynamic

To configure the Rewrite Head plugin you should create a middleware in your dynamic configuration as explained here. The following example creates and uses the rewriteHeaders middleware plugin to modify the Location header

http:
  routes:
    my-router:
      rule: "Host(`localhost`)"
      service: "my-service"
      middlewares : 
        - "rewriteHeaders"
  services:
    my-service:
      loadBalancer:
        servers:
          - url: "http://127.0.0.1"
  middlewares:
    rewriteHeaders:
      plugin:
        rewriteHeaders:
          header: "Location"
          regex: "^http://(.+)$"
          replacement: "https://$1"