Kong: correlation-id gives every request a traceable identifier

One header, generated at the edge and passed to the upstream, ties a client complaint to a log line. Attach it globally so nothing is missed.

Code
curl -X POST http://localhost:8001/plugins \
  --data name=correlation-id \
  --data config.header_name=X-Request-Id \
  --data config.generator=uuid#counter \
  --data config.echo_downstream=true
Output
Upstream receives:  X-Request-Id: 5f2c...#12
Client receives:    X-Request-Id: 5f2c...#12     (echo_downstream)

# If the header is already present Kong keeps it, so an id generated further
# out survives. echo_downstream is off by default - turn it on so a user can
# quote the id from a failed request.
#
# uuid#counter is cheaper than uuid: one uuid per worker plus a counter.
Advertisement

Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.

Published 2026-08-25