Enrich a flow without touching the upstream
Reshape a flow without touching the service.
A named, conditional policy attached to a host or an operation adds a header, masks a field, caches a response or consults a decision service. The service behind does not change.
The path
- NameA policy declared once, reused
- ConditionA CEL condition, compiled at load: false, the policy is skipped
- AttachTo the gateway, a host, a route or an operation
- SimulateThe chain checked as a dry run before serving
An invalid condition or a rewritten protected element is refused at load: the error shows before production. At run time, a false condition skips the policy; a decision service that answers deny gives a 403.
Configuration
The transformations example, as it ships with Flexway v1.6.3.
# Enriching a flow without touching the upstream: named policies, a CEL condition, composed
# global -> host -> routes -> operation, the most precise wins, `!name` removes.
version: 1
contracts:
openapi: ./openapi.yaml
upstreams:
default:
url: http://orders.internal:8080
auth:
issuers:
- name: customers
discovery: https://login.example.net/.well-known/openid-configuration
audience: api
policies:
definitions:
plan-header:
type: header-inject
when: "has(auth.subject)" # CEL: authenticated callers only
config:
set: { x-plan: "{{ auth.claims.plan }}", x-operation: "{{ route.operation_id }}" }
on_missing: skip # skip | empty | fail - required for an expression
strip-server:
type: header-remove
phase: response # on what the upstream answers
config: { names: [server, x-powered-by] }
v2-path:
type: rewrite-path # the upstream's path, never the served one
config: { to: "/v2/orders/{id}" }
channel:
type: query-inject
config: { set: { channel: gateway } }
chains:
global: [strip-server]
routes:
"/orders/*": [v2-path, channel] # * one segment, ** any numberFeatures
What is delivered in the published release v1.6.3, and what is coming; a feature is never shown as delivered before its release.
| Feature | Status |
|---|---|
| Request and response headers: set, remove, rename, derive | Delivered · v0.1.0 |
| Path rewrite and query parameters | Delivered · v0.1.0 |
| Body field projection and filtering, schema conformance checked | Delivered · v1.1.0 |
| Masking of sensitive fields in responses | Delivered · v1.1.0 |
| Upstream Cache-Control, ETag and Vary honoured | Delivered · v1.1.0 |
| Public response cache, per operation | Delivered · v1.1.0 |
| External call: timeout budget and declared failure behaviour | Delivered · v1.1.0 |
| Dry-run simulation of a policy chain | Delivered · v0.1.0 |
Going further
Let's talk about your gateway
Flexwiz is a young company: you talk directly with the person who founds it. Tell us what you want to run through Flexway. We talk about your infrastructure and your digital sovereignty requirements.
Online booking is coming soon; until then, an e-mail is enough.