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

时间:2019-10-22 12:56:45

标签: trace traefik

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

1 个答案:

答案 0 :(得分:0)

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"

...