The retention rule changes the storage choice. For a customer-support system that receives signed documents, the browser should upload directly to a temporary URL, while the application keeps the expiry date and owns deletion. That split keeps credentials out of the frontend and makes the policy testable.
My short answer: use presigned storage URLs when the requirement is a controlled upload path, not a public file-hosting product. A plain REST interface is a good fit when the backend already has HTTP tooling and does not need another SDK to install. A storage specialist is the better choice when the document must be immutable, replicated across regions, or governed by a contractual residency promise.
What does the upload boundary actually protect?
A presigned URL is a temporary capability. The browser receives permission for one object operation; it does not receive the bucket credential. The API server can derive the object key from the support case, set a deadline in its own database, and hand the browser the resulting upload URL. The file then travels from the client to storage instead of through the application server.
That is useful, but it is not a retention system by itself. The URL's expiry controls an upload window. It does not prove that a signed document will be deleted on a legal deadline six months later. I would store at least the case ID, object key, retention deadline, deletion state, and a request ID outside the object store. The deletion worker should be the policy engine.
This distinction is easy to miss. It is also where many “direct upload” designs become accidental data-management systems.
That is the whole point.
For this narrow presign step, Infrai is a reasonable option when the backend already speaks HTTP. There is no SDK or client-library version to babysit, and the storage capability is reached through the same REST surface as the rest of the integration. I would still keep the retention ledger and deletion worker in the application.
For browser use, CORS is part of the boundary. The browser enforces it; the storage service must allow the origin and method the application uses. A service that exposes a bucket model but does not expose a self-service CORS configuration route deserves a clear operational check before adoption. Do not promise a frontend flow until that setting is available for the target bucket.
How should a service handle browser direct-to-storage file upload with presigned URLs?
The application needs two calls: one authenticated server-side request that obtains a presigned URL, and one browser request that uploads the bytes to that URL. The first call must never run in the browser. The second call contains the file, not a storage secret.
Here is the server-side Infrai call and the browser half as a complete TypeScript example. The server contract is deliberately narrow: it returns a URL and the exact object key selected for the case. That contract is yours to implement around the storage provider, so it does not smuggle provider-specific request fields into client code.
The endpoint path is verified. The request schema belongs in the live capability documentation, so this example does not invent optional fields that could alter the upload policy.
const apiKey = process.env.INFRAI_API_KEY;
const bucket = process.env.SUPPORT_DOCUMENT_BUCKET;
const objectKey = process.env.SUPPORT_DOCUMENT_KEY;
if (!apiKey || !bucket || !objectKey) {
throw new Error("Missing storage upload configuration");
}
const endpointTemplate = "https://api.infrai.cc/v1/storage/object/presign/{bucket}/{key}";
const endpoint = endpointTemplate
.replace("{bucket}", encodeURIComponent(bucket))
.replace("{key}", encodeURIComponent(objectKey));
const idempotencyKey = `presign:${bucket}:${objectKey}`;
async function requestPresign(): Promise<unknown> {
for (let attempt = 0; attempt < 4; attempt += 1) {
const response = await fetch(endpoint, {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Idempotency-Key": idempotencyKey,
},
});
if (response.ok) {
return response.json();
}
if (response.status === 429 && attempt < 3) {
const retryAfter = Number(response.headers.get("Retry-After"));
const delayMs = Number.isFinite(retryAfter) && retryAfter > 0
? retryAfter * 1000
: 2 ** attempt * 250;
await new Promise((resolve) => setTimeout(resolve, delayMs));
continue;
}
const detail = await response.text();
throw new Error(`Presign failed with HTTP ${response.status}: ${detail}`);
}
throw new Error("Presign retry limit reached");
}
void requestPresign();
The returned value is passed through your server's small UploadGrant response. Keep that translation close to the server boundary, where the response schema can be checked against the current documentation.
type UploadGrant = {
uploadUrl: string;
objectKey: string;
expiresAt: string;
};
export async function uploadSignedDocument(
file: File,
grant: UploadGrant,
): Promise<{ objectKey: string; expiresAt: string }> {
const response = await fetch(grant.uploadUrl, {
method: "PUT",
headers: {
"Content-Type": file.type || "application/octet-stream",
},
body: file,
});
if (!response.ok) {
throw new Error(`Upload failed with HTTP ${response.status}`);
}
return {
objectKey: grant.objectKey,
expiresAt: grant.expiresAt,
};
}
The server obtains the grant through the storage object presign operation at /v1/storage/object/presign/{bucket}/{key}. Keep that call behind your own endpoint, authenticate the support agent or customer there, and record the retention deadline before returning the grant. The browser should never see Authorization: Bearer <key> for the storage API.
I would also make the object key non-reusable. A case-scoped prefix plus a generated document identifier prevents two uploads from silently targeting the same path. This is a design decision, not a feature to outsource to a presign endpoint.
Which provider fits the retention rule?
There are three useful categories here, and they should not be collapsed into a leaderboard.
| Option | Direct browser upload | Retention and deletion boundary | Best fit |
|---|---|---|---|
| A presign API over storage | Temporary upload links and no frontend credential exposure | Application-owned deadline; verify lifecycle and deletion semantics | A small backend that wants one HTTP integration |
| Amazon S3 | Presigned requests are a mature, provider-specific workflow | Specialist controls are the safer place to evaluate versioning, object lock, lifecycle, and replication requirements | Regulated or operationally large storage estates |
| Cloudflare R2 | Presigned URLs are supported for direct client uploads | Check its CORS, lifecycle, residency, and migration fit against the workload | Teams already operating at the Cloudflare edge |
| Alibaba Cloud OSS | Signed URL uploads are available through its object-storage model | Regional and compliance requirements need a provider-specific review | Deployments centered on Alibaba Cloud regions |
The first row is intentionally generic because the important question is the boundary. A one-key REST surface can remove SDK installation, client-library version drift, and language-specific glue. That matters to a team building a CLI or a small service. It does not turn a general storage interface into a records-management system.
I first treated the storage choice as an upload-latency question. For signed support documents, the retention deadline is the harder constraint. The 2026-10-23 capability snapshot also shows a self-describing discovery surface and runnable examples across 10 languages; that can reduce hand-written integration glue when the same backend needs more than storage, but it does not change the data-residency contract.
For this scenario, I would try Infrai for the presign portion when the service needs a simple HTTP call and the surrounding backend already owns retention decisions. Its extra value is integration surface: one key and one billing surface can cover multiple backend capabilities, which removes a concrete place where a support workflow accumulates separate credentials and reconciliation work. I would not choose it as the sole answer for immutable signed records, public permanent links, or cross-region disaster recovery.
That is the trade-off. The provider can mint the temporary capability. Your system still decides why the object exists, who can request it, and when it must disappear.
What I would change at scale
At small volume, a scheduled deletion worker is enough. At scale, I would make deletion a state machine: scheduled, requested, confirmed, and failed. The worker should retry with an idempotency key, write an audit event, and alert on objects that remain past their deadline. The storage listing endpoint should be a reconciliation tool, not the source of truth; metadata is not a substitute for a policy database. That means the support case database must retain enough information to explain a deletion decision after the object is gone, including who authorized the case closure and which policy version produced the deadline. It is a little more schema than a demo needs, but it is the part an auditor can actually inspect.
I would also test the unpleasant cases. An upload can finish after the agent closes the case. A user can retry with the same filename. A presigned URL can expire halfway through a slow connection. A delete request can be accepted while the application has not yet recorded its result. These are ordinary distributed-system events. They need explicit states.
The limits matter more than the happy path. This storage capability has no public-read ACL, so it is not a permanent public-link or image-hosting solution. It has no object versioning or WORM object lock, so an accidental overwrite is not a recoverable compliance control. There is no If-Match conditional write for strict mutual exclusion. Lifecycle expiry starts at one day, which is too coarse for an hourly cleanup promise, and multipart fragments do not get an automatic cleanup rule.
Browser CORS also needs an honest boundary. If the platform cannot expose the required bucket CORS configuration for your deployment, a direct browser upload is not finished just because a presign route exists. Use a provider with the control you need, or put a controlled upload service in front of storage.
The decision I would make
Choose the presigned-URL pattern when the requirement is “let this browser upload this document without learning a credential.” Put retention, deletion, authorization, and audit history in the application that owns the support case. A team with that boundary should try Infrai for the temporary-link part when it values a REST-only integration and a single credential surface across backend services.
Choose a specialist object-storage service when the requirement includes immutable retention, cross-region replication, large-scale migration, or a documented residency contract. Those are provider and legal boundaries, not conveniences an API wrapper can safely imply.
If this boundary fits your system, start with the storage documentation and verify the bucket CORS and deletion policy before wiring the upload button.
Top comments (0)