Edge Routing

Requests to api.captain.dev now connect at an edge location near the caller and travel a private backbone to Captain. The public endpoint, authentication, and request format are unchanged: same endpoint, same keys, nothing to migrate.

Why it matters

Global networking is part of taking a RAG pipeline from a local prototype to production. A search index can respond quickly while users far from the server still wait for connection setup. Measuring the full request from the caller’s location makes that overhead visible.

A DIY RAG pipeline needs to account for connection reuse, routing, and the operational work of serving users across regions. Captain handles the edge connection and onward routing without requiring a separate search deployment in every caller’s region. Edge Routing changes the network path; it does not replicate the search index to each edge location.

When an integration opens a fresh HTTPS connection for a query, connection setup adds network round trips. The TLS handshake on that connection used to cross the public internet end-to-end. With edge routing, the handshake terminates at the nearest edge location, and the request travels to Captain over a private backbone.

The improvement is largest for callers far from the origin region. Median Query Time on fresh connection · 100 samples / city:

Calling fromBeforeAfterChange
São Paulo805 ms590 ms−27%
Singapore1,136 ms692 ms−39%
Sydney1,065 ms661 ms−38%
Dublin687 ms529 ms−23%
Frankfurt738 ms555 ms−25%
San Francisco641 ms516 ms−20%
Portland656 ms551 ms−16%

When it does not help

Connection reuse (HTTP keep-alive) already skips the handshake. A long-lived client that reuses connections avoids repeated connection setup, so the fresh-connection results should not be applied to every query on that connection. The benefit depends on connection reuse and the caller’s network path.

Verifying the route

A query response includes a cf-ray header from the edge. Its suffix is the IATA airport code of the edge location that handled the connection (for example, ...SIN for Singapore, ...GRU for São Paulo). Seeing a code near the caller confirms the request was terminated at the edge.

curl -sI -X POST https://api.captain.dev/v3/collections/test/query \
-H "Authorization: Bearer $CAPTAIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"test","limit":1}' 2>&1 | grep -i cf-ray
© 2026 Captain