head_classifier

Classifies a request from its head and promotes the matched class as a reserved, client-unspoofable x-praxis-head-class header.

Versions marked “overview” do not contain this page. Selecting one opens that version’s documentation overview.

On this page

Classifies a request from its head and promotes the matched class as a reserved, client-unspoofable x-praxis-head-class header.

Configuration Notes

Runs in the request-head phase, before any StreamBuffer request-body pre-read, so the class is visible to the pre-read pass, later request-phase filters, and the router (which matches request headers). The first rule whose path_prefix matches the request path supplies the class; an unmatched request takes default_class when set, otherwise no class is published and the chain proceeds unclassified.

The class is also written to head_classifier.class filter metadata and to the head_classifier filter results (class), so a branch chain can split on it. Class values are validated at config time to be safe header values.

Configuration

FieldTypeRequiredDescription
default_classstringnoClass assigned when no rule matches. When unset, an unmatched request publishes no class and the chain proceeds unclassified.
rulesClassRule[]yesOrdered classification rules; the first rule whose path_prefix matches the request path supplies the class.
rules[].classstringyesClass published when path_prefix matches the request path.
rules[].path_prefixstringyesRequest path prefix this rule matches (for example /api/).

Example

filter: head_classifier
rules:
  - path_prefix: /api/
    class: api
  - path_prefix: /assets/
    class: assets
default_class: other