http.request_id

request_id generates a UUID which can be referenced via the {request_id} placeholder, for use in many other directives including header and log

When request_id is used, the {request_id} placeholder will have a value; otherwise it will be empty.

Syntax

request_id [*header_field*]

  • header_field is an optional header field name from which to read an existing request ID. If this field name is set and the field contains a valid UUID, it will be used and a new one will not be created. For the sake of your site’s security, do NOT abuse this feature (i.e. don’t use it to track user sessions).

Examples

Set the request ID in a response header:

request_id header / Caddy-Request-Id {request_id}

Read the request ID from a request header called X-Request-ID, if present:

request_id X-Request-ID

Need help with this feature?

Join us in the Caddy forum, where the open source community gathers to share their knowledge.

Does your company use Caddy?

Purchase a commercial license to use Caddy with your business and for basic email support, along with other benefits!