Each key is a glob pattern, and each value is a mapping of header name to header value(s).
Before an HTTP request is made, each key is matched against the request URL.
If any matches are found, each of their described headers are added to the request.
To add headers to all HTTP requests, use ** as the glob pattern.
Example:
headers {
// Add this user agent to all out-bound requests.
["**"] {
["User-Agent"] = "MyApp-Pkl"
}
// Add an authorization header to all requests made to the
// `https://my.internal.service` host.
["https://my.internal.service/**"] {
["Authorization"] = "Bearer abc123"
}
}
To repeat a header multiple times, set the value to a listing:
Settings that control how Pkl talks to HTTP(S) servers.