如何向 Traefik 添加唯一的请求 ID 标头

Mat*_*t R 5 trace traefik

在Traefik中,是否可以向请求添加唯一的Request ID标头?我希望能够将访问日志与后端服务的日志关联起来。

Xpl*_*der 1

AFAIK 不支持它,但是 Traefik 2.3.6 中有一个功能解决方法:

# static config

...

[tracing]
  # Workaround for the non support of Correlation/Request Id Header
  # - https://github.com/traefik/traefik/issues/4640
  # - https://github.com/traefik/traefik/pull/6707#issuecomment-640429009
  [tracing.jaeger]
    samplingParam = 0
    traceContextHeaderName = "X-Correlation-Id"

...

Run Code Online (Sandbox Code Playgroud)