Skip to content
Fluxer API

Upload relay

The upload relay stores the bytes of one file at a signed upload URL. Request attachment upload URLs and Create stream preview upload URL issue these URLs. See Attachment uploads for the whole flow.

The t query parameter is a signed token for one object or multipart part, and the relay ignores the Authorization header. Send the request to the URL exactly as the HTTP API returned it and keep the URL private. The URL expires after 900 seconds unless the instance sets another lifetime.

PUT/v1/relay/{key}

Stores the object or multipart part the upload URL authorizes, and returns the ETag from storage when storage sends one.

FieldTypeDescription
tstringThe upload token
uploadId?stringThe multipart upload ID, when the issued URL has one
partNumber?integerThe multipart part number, when the issued URL has one
FieldTypeDescription
Content-Length?integerThe length of the body, which must match the bytes you send
Content-Type?stringThe media type to store, used when the upload URL sets none
StatusBodyCondition
200emptyThe object or part was stored
400Bad RequestpartNumber is not a number, or the body ended before Content-Length or arrived too slowly
401Unauthorizedt is missing, invalid or expired
403ForbiddenThe key, uploadId or partNumber does not match the token
404Not FoundThe Media Proxy is not running in upload or relay mode
405emptyThe method is not PUT or OPTIONS
413Payload Too LargeThe body is longer than Content-Length, the authorized size or the body limit
500Internal Server ErrorThe relay could not store the upload locally
502Bad GatewayObject storage refused the write
503Service UnavailableThe request has no Content-Length and the relay's temporary upload space is full

You can retry a 502 or 503 until the URL expires. Responses allow requests from any origin, and a preflight OPTIONS request gets a 204.

FLUXER_MEDIA_PROXY_UPLOAD_RELAY_MAX_BODY_BYTES sets the body limit, which defaults to 500 MiB. FLUXER_MEDIA_PROXY_UPLOAD_RELAY_S3_TIMEOUT_MS sets the write deadline, which defaults to 900,000 ms.

The largest body the relay accepts is the smaller of the body limit and the authorized upload size. When the request has Content-Length, the relay adds one second to the write deadline for every 16 KiB of declared length, and it returns 400 if the body takes longer.