Connection
Introduction
The Connection tab is how swarmvia reaches your upstream: where it sends requests, and how it signs in there. Open Sources → Connection for a source. Who may call the source through swarmvia is the Access tab.
For an HTTP source, the origins and the upstream credential save together, so the form can say what an origin change does to the credential before you save. A database source keeps its connection, its login, and the connection test here too (see Database and JDBC).
Origins
Each source pins 1-8 origins. Per request, origin selection is:
X-Swarmvia-Originif present (must exactly match a configured origin)- Otherwise the longest matching
pathPrefix - Otherwise the first origin without a path prefix
- Otherwise
400. SendX-Swarmvia-Origin
Managed sources never call hosts outside the pinned set.
Custody
Pass-through
Your client authenticates to the upstream. swarmvia relays the request (and
headers such as Authorization) after admitting a slot. Use
X-Swarmvia-Key for the access key. Do not put the access key in Authorization.
Managed
swarmvia attaches an encrypted upstream credential on each proxied request (for example static bearer, basic, API key, OAuth 1.0, OAuth2 client-credentials, or OAuth2 refresh token). Callers authenticate only with an access key.
The upstream credential
A managed source's credential belongs to it. The Connection tab shows its status and when it was last rotated, with Edit, Rotate, Test, or Connect, whichever it needs. Replace stores a new one and deletes the old one. Each source has its own credential; there is no separate credentials page.
Changing origins or the auth method
swarmvia never sends a credential to a host it was not attached for.
- Removing or reordering origins keeps the credential attached.
- Adding an origin detaches it, unless you check Keep sending the credential to the new host. The form names the new hosts before you save. Keep it only when those hosts belong to the same upstream.
- Changing the auth method, or switching to pass-through, always detaches it: the stored secret is the wrong shape for the new method.
Until a credential is attached again, upstream requests fail. A detached credential is offered back on the Connection tab: Re-attach sends it to the origins listed at the time, and Delete it throws it away. Attaching any other credential deletes it.
Origin verification (outbound HMAC)
Enable Origin verification on Sources → Connection. swarmvia then signs every request it forwards so your origin can prove traffic came through swarmvia and reject direct callers.
The canonical string hashes only the first 1 MB of the body and binds
Content-Length, so large uploads can stream. The secret is a source-level
osk_… value (shown once when you enable or rotate).
What swarmvia sends upstream
After stripping every inbound X-Swarmvia-* header (callers cannot forge these),
swarmvia adds:
| Header | Value |
|---|---|
X-Swarmvia-Timestamp |
Fresh epoch seconds |
X-Swarmvia-Nonce |
Fresh UUID (new on every attempt, including retries) |
X-Swarmvia-Signature |
Hex HMAC-SHA256 of the outbound canonical string with osk_… |
Canonical string (fields joined with \n):
METHOD
PATH
QUERY
SHA256(BODY_PREFIX)
CONTENT_LENGTH
TIMESTAMP
NONCEPATH / QUERY are what the origin receives (forwarded verbatim).
BODY_PREFIX is the first min(body length, 1 MiB) raw bytes (empty body →
SHA-256 of empty input). CONTENT_LENGTH is the decimal full body length
swarmvia forwards (0 when empty).
Limits
| Limit | Behavior |
|---|---|
| Prefix window 1 MB | Only the first mebibyte is hashed; the rest streams |
Declared Content-Length on large bodies |
Preferred; bodies over 1 MB stream without a 10 MB reject |
No Content-Length and body > 10 MB |
413 payload_too_large (length cannot be bound without buffering) |
| Clock skew at origin | Match ±300 seconds |
Nonce replay defense at the origin is optional (swarmvia already mints a fresh nonce per attempt). Retry-on-429 still needs a re-readable body under 10 MB; larger bodies with a declared length run as a single streamed attempt and are still prefix-signed.
Rotation
Mint a new secret, update the origin to accept both old and new, then Activate in the dashboard. Discard a pending secret if you abort the rotation.
Worked verification code: Determine a request came from the proxy.