custom-response

Answers the request itself with a fixed status, headers and body — no upstream needed.

Phaseson_http_requeston_http_response
Terminating Yes — once it answers, nothing after it runs.
Cost Free

Example

policy.yaml
on_http_request:
  - name: Maintenance
    expressions:
      - "!req.url.path.startsWith('/health')"
    actions:
      - type: custom-response
        config:
          status_code: 503
          headers:
            content-type: text/html
          body: "<h1>Back soon</h1>"

Start an agent endpoint with it: devgate http 8080 --traffic-policy-file policy.yaml, or paste it into a reserved or cloud endpoint’s Traffic Policy tab in the dashboard.

Configuration

Field Type Description
status_code integer HTTP status, 100 to 599. Default: 200.
body string Response body. May use ${…} interpolation.
headers map Up to 10 response headers. Without content-type, it is inferred from the body.

Behaviour

  • It is terminating, so on its own it satisfies a cloud endpoint’s need to answer every request.
  • In on_http_response it replaces whatever your service answered.

Other actions

add-headers remove-headers compress-response basic-auth oauth openid-connect jwt-validation deny redirect url-rewrite restrict-ips rate-limit circuit-breaker verify-webhook http-request set-vars log close-connection forward-internal