Skip to main content

Module error_page

Module error_page 

Source
Expand description

The error-page node — replaces the body and content type of gateway-generated error responses (404, 500, 502, 503) with configured pages. Port of APISIX’s error-page plugin (response-phase: place after upstream, before client).

Deviations from APISIX:

  • APISIX configures the pages via plugin metadata (with an enable flag); featherbit has no metadata tier, so the pages live directly in the node config and placing the node in the graph is the enable switch.
  • APISIX only intercepts responses whose source is not the upstream (get_response_source(ctx) ~= "upstream"). featherbit’s equivalent heuristic is Context.errors being non-empty — a response produced by a node that failed (upstream connection error, a failed IdP callout, the error-handler that rendered it) always carries the error record that routed it there, while a clean upstream response does not. An upstream’s own 502 therefore passes through untouched, exactly as in APISIX.

§Outcome exits are not replaced

gateway_generated keys on the presence of an error record, so this node does not touch responses that arrived on an outcome port — a denied 403, a limited 429, a broken 503, an abort. Those are deliberate, already-formed responses and carry no error record. They also do not normally pass through here at all: an outcome port is wired straight to client. To style them, wire that port through a response-shaping node (response-rewrite, or exit-transformer with always: true) on its way to client instead of expecting error-page to catch them.

Structs§

ErrorPage 🔒
One configured error page.
ErrorPagePlugin
Replaces Context.response.body and content-type when the response was generated by the gateway (heuristic: Context.errors non-empty) and its status code has a configured page. All other responses pass through unchanged. This plugin never fails at execution time.

Constants§

SUPPORTED_STATUS 🔒
The status codes APISIX’s error-page supports (its metadata schema hardcodes error_404 / error_500 / error_502 / error_503).

Functions§

default_body 🔒
The default page body, mirroring APISIX’s err_body template (with the gateway’s own name in the footer).