Skip to main content

Direct Response

FastGateway can return static responses directly without forwarding to backends.

Basic Direct Response

Return a simple response:

filters:
- type: "DirectResponse"
directResponse:
statusCode: 200
body: "OK"

Health Check Endpoint

Create a health check endpoint:

matches:
- path:
type: "Exact"
value: "/health"
filters:
- type: "DirectResponse"
directResponse:
statusCode: 200
body: '{"status": "healthy"}'

Maintenance Page

Return a maintenance response:

filters:
- type: "DirectResponse"
directResponse:
statusCode: 503
body: '{"error": "Service temporarily unavailable for maintenance"}'

Custom Error Pages

Block specific paths with custom responses:

matches:
- path:
type: "Prefix"
value: "/admin"
filters:
- type: "DirectResponse"
directResponse:
statusCode: 403
body: '{"error": "Forbidden"}'

Use Cases

ScenarioStatus Code
Health checks200
Readiness probes200
Maintenance mode503
Blocked paths403
Not found pages404

Notes

  • No backend is contacted when DirectResponse is used
  • Combine with header modification for proper Content-Type
  • Useful for synthetic endpoints that don't need backend logic