Connector Proxy¶
A connector-proxy is an optional application that can be deployed alongside (or separately from) the frontend and backend. Please see Connector Proxy in 5 mins.
Connector proxies are containers for connectors. In this repository, connectors are Python libraries that are included in connector proxy codebases, and some proxies embed connector logic directly (see the async-http example below). Our connector-proxy-demo includes a few connectors, including connector-aws, connector-http, connector-slack, and connector-smtp. Connector-http can be used for many API interactions, but you can also write your own connectors.
async-http Example¶
The async-http example demonstrates a simple and explicit connector proxy pattern:
A command discovery endpoint that returns available commands and parameter schemas
A set of execution routes, one per command
A consistent response envelope for results, with a versioned contract
Implementation notes:
Built with Falcon ASGI (
falcon.asgi.App)Uses httpx.AsyncClient for outbound requests (
timeout=Nonein the sample)Uses orjson for JSON parsing
Enables CORS (
cors_enable=True)
Important: This implementation is intentionally minimal (for example, error handling is marked TODO) and should be hardened before production use. See Security & Production Hardening.
Running async-http with Docker Compose¶
Example compose service:
services:
connector-proxy-async-http:
build:
context: connector-proxies/async-http
dockerfile: Dockerfile
environment:
HOST: "0.0.0.0"
PORT: "${CONNECTOR_PROXY_ASYNC_HTTP_PORT:-8200}"
XDG_CACHE_HOME: "/app/.cache"
ports:
- "${CONNECTOR_PROXY_ASYNC_HTTP_PORT:-8200}:${CONNECTOR_PROXY_ASYNC_HTTP_PORT:-8200}/tcp"
Start the service:
docker compose up --build
By default, the port published is:
http://localhost:8200(whenCONNECTOR_PROXY_ASYNC_HTTP_PORTis not set)
API: Command Discovery¶
GET /v1/commands¶
Returns a list of supported commands and their parameter schemas. This makes the connector proxy self-describing.
The async-http example exposes these commands:
http/DeleteRequesthttp/GetRequesthttp/HeadRequesthttp/PatchRequesthttp/PostRequesthttp/PutRequest
Each command includes a parameters array describing:
id(parameter name)typerequired(true/false)
API: Command Execution¶
Each command is executed through a dedicated route:
POST /v1/do/http/DeleteRequestPOST /v1/do/http/GetRequestPOST /v1/do/http/HeadRequestPOST /v1/do/http/PatchRequestPOST /v1/do/http/PostRequestPOST /v1/do/http/PutRequest
All execution routes:
accept a JSON request body
make an outbound HTTP request using
httpx.AsyncClient.request(...)return a standard response envelope
Parameters (/v1/commands)¶
These are the schema definitions returned by async-http and should be treated as the public contract.
Common parameters (all commands)¶
url(required, string) — Target URLheaders(optional, any/object) — Request headers
Optional basic authentication (supported)¶
basic_auth_username(optional, string)basic_auth_password(optional, string)
GET / HEAD commands¶
params(optional, any/object) — Query string parameters
DELETE / PATCH / POST / PUT commands¶
data(optional, any/object) — request body.body_format(optional, string) — how to senddata; defaults tojson. Supported values arejson,form,raw, andnone.include_response_headers(optional, boolean) — when true, include upstream response headers incommand_response.headers.
Note: In this example,
DeleteRequestis advertised withdata(notparams) in the command schema.
The embedded Arena HTTP connector also supports body_format and include_response_headers on its standard write commands.
Request and Response Examples¶
For detailed examples of request payloads and response structures, including:
Sample requests for GET, POST, PUT, PATCH, DELETE, and HEAD operations
Response envelope structure and parsing behavior
Error response examples
Long-running task callbacks
See the Connector Proxy API Examples page.
Error Handling Notes¶
The async-http example is intentionally minimal:
erroris included but may not be populated in all casesthe HTTP client is configured with
timeout=None
For production use, implement:
consistent error objects in
errorexception handling for upstream failures and parsing errors
timeouts and retry policies appropriate for your environment
API Key Authentication¶
If SpiffArena is configured with a SPIFFWORKFLOW_BACKEND_CONNECTOR_PROXY_API_KEY, it will include a Spiff-Connector-Proxy-Api-Key header on every request it sends to the connector proxy.
Your connector proxy implementation can validate this header to restrict access to authorized SpiffArena instances only.
See Configure a Connector Proxy for how to set the key.