https://github.com/luludotdev/caddy-requestid
Caddy v2 Module that sets a unique request ID placeholder.
https://github.com/luludotdev/caddy-requestid
caddy caddy-plugin caddyserver
Last synced: about 1 year ago
JSON representation
Caddy v2 Module that sets a unique request ID placeholder.
- Host: GitHub
- URL: https://github.com/luludotdev/caddy-requestid
- Owner: luludotdev
- License: mit
- Created: 2020-07-27T19:54:07.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-08-11T08:17:34.000Z (almost 3 years ago)
- Last Synced: 2025-03-31T05:41:31.124Z (about 1 year ago)
- Topics: caddy, caddy-plugin, caddyserver
- Language: Go
- Homepage:
- Size: 169 KB
- Stars: 23
- Watchers: 1
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Caddy Request ID
> Caddy v2 Module that sets unique request ID placeholders.
## Usage
### Caddyfile
```
request_id [] {
[ ]
...
}
```
* **length** - length of ID to generate, defaults to 21
* **key, length** - additional keys to generate independent IDs for
If you wish to use the directive in a top level block, you must explicitly define the order.
```
{
order request_id before header
}
```
### JSON Config
```json5
{
"handler": "request_id",
"length": 21, // optional
"additional": { // optional
"header": 21,
}
}
```
### Placeholders
The top level request ID will be set in the `{http.request_id}` placeholder. Any additional IDs will be set in the `{http.request_id.}` placeholder.
## Example
The following example Caddyfile sets a different request ID for response bodies and headers.
```
{
order request_id before header
}
localhost {
request_id {
body 10
header 21
}
header * x-request-id "{http.request_id.header}"
respond * "{http.request_id.body}" 200
}
```