Overview
Request rules restrict which requests an origin configuration handles. When request_rules is set, only requests matching at least one rule are processed. Non-matching requests either return a 404 or cause the origin to be skipped entirely (when must_match_rules is true), allowing a different origin to handle the request.
Capabilities
- Path, method, header, and IP matching using the standard rules system
- OR logic across rules (any match passes)
must_match_rulesoption to skip the origin entirely on no match (enables multi-origin fallback)- Configurable
default_content_typefor error responses (e.g., application/json for APIs)
Example
Restrict an origin to only handle versioned API requests:
proxy:
http_bind_port: 8080
origins:
"api.example.com":
request_rules:
- path:
prefix: /v1/
methods:
- GET
- POST
- path:
prefix: /health
default_content_type: application/json
action:
type: proxy
url: https://test.sbproxy.dev
Test it:
curl -H "Host: api.example.com" http://localhost:8080/