headers: Rule.SetFunc computes headers per request #42

Merged
mikluko merged 1 commit from feat/setfunc into main 2026-10-26 21:43:07 +00:00
Owner

Closes #40.

Implements the proposal as written. Rule.SetFunc runs per matching request, after Delete and Set. Its headers replace existing ones as Set's do. It gets the request with its context, and a nil result changes nothing.

An error fails closed: the client gets 502 Bad Gateway with a generic body, the request is not forwarded, and the error goes to the server log through the log helpers with the host. Caching is left to the function, as the issue settled. The CLI flags are unchanged.

The header-rewriting how-to gains a section with the issue's example.

Closes #40. Implements the proposal as written. `Rule.SetFunc` runs per matching request, after `Delete` and `Set`. Its headers replace existing ones as `Set`'s do. It gets the request with its context, and a nil result changes nothing. An error fails closed: the client gets `502 Bad Gateway` with a generic body, the request is not forwarded, and the error goes to the server log through the `log` helpers with the host. Caching is left to the function, as the issue settled. The CLI flags are unchanged. The header-rewriting how-to gains a section with the issue's example.
headers: Rule.SetFunc computes headers per request
All checks were successful
CI / changelog (pull_request) Successful in 4s
CI / test (pull_request) Successful in 1m18s
ef2b17ed3e
For values a fixed http.Header cannot hold: short-lived tokens, credentials
chosen by the request, values from a secret store. An error fails closed with
502, so the request never goes upstream without the header the rule was meant
to set.

Closes #40
mikluko deleted branch feat/setfunc 2026-10-26 21:43:07 +00:00
Sign in to join this conversation.
No description provided.