Skip to main content

Serving Static Responses with Custom Response Policies

There are scenarios where you may want to issue static responses directly from the API Gateway rather than forwarding requests to an upstream service. This allows you to handle specific request patterns efficiently without consuming backend resources.

By defining custom response rules, you can:

đź›  Return predefined error messages, such as a common 404 Not Found page.
⚡ Reduce backend load by handling certain requests at the gateway level.
🚀 Improve response times for static responses, such as maintenance messages.

🔍 What are the Benefits of Static Responses?​

Instead of routing every request to your upstream services, certain requests can be handled at the gateway layer, improving efficiency and reducing unnecessary backend calls.

Key Benefits:

  • Reduce Backend Load: Offload simple responses without hitting your backend.
  • Improve Performance: Serve common responses instantly at the edge.
  • Standardize Error Handling: Return the same response across multiple applications.
  • Enhance Availability: Provide a fallback response if your backend is unavailable.
  • Handle Maintenance Windows Gracefully: Display a scheduled maintenance message without modifying backend applications.

Static Response Examples​

The following examples create an endpoint that returns a custom HTML maintenance page back for all requests to your endpoint.

Check out the custom response traffic policy action page for more details about how it functions and the parameters it accepts.

Loading…