Skip to content

AdamEszes/traefik-custom-headers-plugin

Repository files navigation

Rename Header

Traefik custom headers plugin is a middleware plugin for Traefik which renames headers in the response, while keeping their values.

Configuration

Static

pilot:
  token: "xxxx"

experimental:
  plugins:
    renameHeaders:
      modulename: "gitlab.com/traefik-custom-headers-plugin/traefik-custom-headers-plugin"
      version: "v0.0.1"

Dynamic

To configure the Rename Headers plugin you should create a middleware in your dynamic configuration as explained here. The following example creates and uses the renameHeaders middleware plugin to rename the "custom_id" header

http:
  routes:
    my-router:
      rule: "Host(`localhost`)"
      service: "my-service"
      middlewares : 
        - "renameHeaders"
  services:
    my-service:
      loadBalancer:
        servers:
          - url: "http://127.0.0.1"
  middlewares:
    renameHeaders:
      plugin:
        renameData:
          - existingHeaderName: "Customheader"
          newHeaderName: "customheader"