Skip to main content

Proxying API Reference

Synentra acts as a reverse proxy gateway. Any HTTP request prefixed with /proxy/ is intercepted, evaluated, and either forwarded to the upstream service, blocked, or put on hold for human-in-the-loop (HITL) approval.

The proxy supports all HTTP methodsGET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, etc. – and forwards the method, headers, and body (when present) to the upstream service.

Base URL

Throughout this guide the base URL is assumed to be your running server, e.g. http://localhost:7080. Replace <BASE_URL> in the examples with your actual server address.


URL Format

<method> <BASE_URL>/proxy/<full-upstream-url>

The full absolute URL of the upstream target is embedded in the path:

GET /proxy/https://api.example.com/users/123
Authorization: Bearer <agent-jwt>
info

Query strings embedded in the target URL are preserved and forwarded correctly.

Supported response codes

StatusDescription
Upstream statusRequest was allowed and forwarded. Returns upstream response.
202 AcceptedRequest intercepted — HITL review required. Location header set.
401 UnauthorizedMissing or invalid agent token
403 ForbiddenAgent is revoked or policy denied the request
429 Too Many RequestsRate limit exceeded
503 Service UnavailableCircuit breaker open for upstream host

Request Forwarding (for Allowed Requests)

When a request is allowed, Synentra constructs a new HttpMessage and forwards it.

Headers forwarded:

  • All headers from the original request except those listed below.

Headers NOT forwarded:

  • The authorization header name is configurable via SecurityConfiguration.AgentAuth.CustomHeaderName (default: "Synentra-Authorization"). The configured header is excluded from forwarding.
  • Host – The host is set automatically from the target URI.
  • Connection, Content-Length, Transfer-Encoding, Proxy-Connection, TE, Keep-Alive, Upgrade, Trailer – These are managed by the HTTP stack.

Example: Proxying a GET Request

1. Proxying a GET Request

The following example sends a request to https://jsonplaceholder.typicode.com/todos/1 through the Synentra gateway.

curl -X GET "http://localhost:7080/proxy/https://jsonplaceholder.typicode.com/todos/1" \
-H "Synentra-Authorization: Bearer <your-agent-jwt>"

If the agent is active, within rate limits, the circuit is closed, and the decision engine allows the request, Synentra forwards the request and returns the upstream response unchanged.


2. Proxying a POST Request with a JSON Body

This example sends a POST request with a JSON payload to create a new resource. The request body is evaluated by the decision engine before forwarding.

curl -X POST "http://localhost:7080/proxy/https://api.example.com/users" \
-H "Synentra-Authorization: Bearer <your-agent-jwt>" \
-H "Content-Type: application/json" \
-d '{"name": "John Doe", "email": "john@example.com"}'

3. HITL Interception (DELETE Request)

If the decision engine returns Hitl (for example, when a DELETE operation is deemed risky), the gateway responds with a 202 Accepted status and a Location header for polling.

curl -X DELETE "http://localhost:7080/proxy/https://api.example.com/users/all" \
-H "Synentra-Authorization: Bearer <your-agent-jwt>"

Response:

HTTP/1.1 202 Accepted
Location: /hitl/status/abc-123

Request pending approval. Poll /hitl/status/abc-123

The operator can then approve or deny this request via the HITL endpoints.

Was this helpful?