Sample Configuration
Configuration
When
true, the engine trusts proxy headers such as X-Forwarded-For for client IP resolution. Defaults to false.When
true, routes with and without a trailing slash are treated as equivalent. Defaults to false.Function ID to invoke when no route matches a request. When unset, the engine returns a default 404 response.
Trigger Type
This module adds a new Trigger Type:http.
Sample code
Request & Response Objects
ApiRequest
When an API trigger fires, the function receives anApiRequest object:
ApiResponse
Functions must return anApiResponse object:
HTTP response headers as
"Header-Name: value" strings (e.g., ["Content-Type: application/json"]). Optional.Middleware
The HTTP module supports a middleware system that runs functions at defined phases of the request lifecycle. Middleware functions are registered using thehttp_middleware trigger type.
Phases
Phases execute in priority order (lower number = higher priority).
Middleware Trigger Config
Middleware Function Contract
Middleware functions receive aMiddlewareRequest object:
Middleware must return one of:
{ action: "continue", request?: object, context?: object }— pass control to the next middleware. Optionalrequestandcontextpatches are deep-merged into the current values.{ action: "respond", response: { status_code, body, headers } }— short-circuit and return a response immediately. Subsequent middleware in the same phase is skipped.