In search of traceId placeholder

1. The problem I’m having:

Caddy by default logs traceId, i love it :slight_smile: But, is there way to add traceId to headers too?

Example:

    handle / {

        root * /usr/share/caddy
        try_files {path} /index.html
        file_server
        header traceid {traceID}

    }

2. Error messages and/or full log output:

No errors, just cant find how to pass traceId placeholder (is it exists?) to headers

3. Caddy version:

v2.7.5

4. How I installed and ran Caddy:

docker latest with mounted Caddyfile (above)
DIGEST:sha256:a9c7585fdc50bb28d686b73a9b1f0eb9a3d103efd63c48dc334ccb5f51aa1722

Solution that i just found closely is what i expect

header trace_id {header.traceparent}

Header that contains traceID:

Trace_id":["00-9d373cb8f936837d7ad3d39f59350436-5de4c8b02b96f275-01"]

Hope would be helpful not only for me :slight_smile:

FYI this only handles requests to exactly /. Are you sure that’s what you wanted?

Headers with underscores aren’t spec compliant. You should probably be doing Trace-Id instead.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.