Is there a way to add a request ID to all incoming requests?

Everytime a request is received by traefik, I'd like it to set a header like this.

X-Request-Id: 899f8ddc-d8de-4f37-ae16-a68a98e4ec7e

Then forward that request to my backend service.

I found the headers middleware documentation, however, it seems like maybe this isn't possible.

I also skimmed through some of the open tracing support, but that seems way too heavy-handed for the stage am currently at. I'd just like a simple request ID.

It could be nice to have something like this.

http:
  middlewares:
    testHeader:
      headers:
        customRequestHeaders:
          X-Request-Id: "{{.UUIDV4}}"

Hello @ooF2oh,

There is a plugin that can add a UUID to each of your requests.

The plugin is : Plugin GitHub - kevtainer/uiddemo: traefik plugin demonstrating unique id header injection

It can be installed with this static configuration:

pilot:
    token: "xxxx"
experimental:
    plugins:
        uiddemo:
            moduleName: "github.com/notsureifkevin/uiddemo"
            version: "v0.0.1"

And you can define the header name with the dynamic configuration:

middlewares:
    my-uiddemo:
        plugin:
            uiddemo:
                HeaderName: X-Request-Id