Custom HTTP transport
If your server sits behind an authenticating proxy (Cloudflare Access, Tailscale Funnel, an OAuth gateway), the Subsonic protocol alone is not enough — the proxy needs its own credentials before any Subsonic request reaches the server.
SwiftSonic exposes a custom transport seam so you can attach extra headers to every outgoing request without forking the client.
CustomHeadersTransport
Section titled “CustomHeadersTransport”TODO: confirm the exact type name and constructor in 0.6.x. Likely
CustomHeadersTransportunderSources/SwiftSonic/Transport/. Verify and update.
// TODO: replace with verified API surfacelet transport = CustomHeadersTransport(headers: [ "CF-Access-Client-Id": "<your-client-id>", "CF-Access-Client-Secret": "<your-client-secret>"])
let config = ServerConfiguration( host: "music.example.com", username: "user", password: "pass", transport: transport)Use cases
Section titled “Use cases”- Cloudflare Access —
CF-Access-Client-Id+CF-Access-Client-Secretservice tokens. - Reverse proxies with auth headers (
Authorization: Bearer ...,X-Auth-Token, etc.). - Per-tenant routing (
X-Tenant-Id).
What this does not do
Section titled “What this does not do”The custom transport injects request headers. It does not:
- Handle response decoding (that stays with the client).
- Implement OAuth flows (you supply already-issued tokens).
- Replace the Subsonic auth (
u=,t=,s=are still on the URL).
TODO: document whether the transport is composable (can a user chain custom-headers + retry + logging?) once the protocol surface is confirmed.