Skip to content

Static Responses

Static upstreams return a pre-built response directly from the gateway without proxying to a backend. Useful for health endpoints, mocks, redirects, and fallback responses.

Working example: see examples/static-responses/

Set kind: "static" on x-plenum-upstream:

x-plenum-upstream:
kind: "static"
status: 200
headers:
Content-Type: application/json
body: '{"status": "healthy"}'
FieldRequiredDescription
kindYesMust be "static"
statusYesHTTP status code
headersNoResponse headers
bodyNoResponse body (string)
overlay-static.yaml
actions:
- target: "$.paths['/health'].get"
update:
x-plenum-upstream:
kind: "static"
status: 200
headers:
Content-Type: application/json
body: '{"status": "healthy"}'
Terminal window
$ curl http://localhost:6188/health
{"status": "healthy"}
x-plenum-upstream:
kind: "static"
status: 301
headers:
Location: "https://example.com/new-path"
x-plenum-upstream:
kind: "static"
status: 204

Static and proxied routes can coexist in the same spec. Apply the static upstream to specific paths and proxy the rest:

actions:
# Static health endpoint
- target: "$.paths['/health']"
update:
x-plenum-upstream:
kind: "static"
status: 200
headers:
Content-Type: application/json
body: '{"status": "healthy"}'
# Proxy everything else
- target: "$.paths['/products']"
update:
x-plenum-upstream:
$ref: "#/components/x-upstreams/default"