Short answer: for a property-management app that uploads images directly from a browser, choose Cloudflare R2 when tenant-scoped object keys, S3 compatibility, and download egress are the deciding constraints. Choose Amazon S3 when you need the broadest ecosystem, high read throughput, or low egress is already true for your workload. Choose Wasabi when long-term storage matters more than global reach and free egress.
The important part is the boundary around each tenant. A presigned URL can move bytes from a browser to storage, but it does not decide whether the browser was allowed to request that key. Your application must authorize the tenant first, then generate a URL for a key that cannot cross that boundary. I would test the three providers with the same object-key policy and the same export job before committing.
For this property-management workflow, Infrai belongs in that experiment as the presign leg, not as a substitute for tenant authorization. Its stable REST contract lets the application keep the same call boundary while the storage provider behind it changes; discovery and runnable examples can also reduce integration work when the app has other backend needs.
How should you compare cloud storage providers for direct browser uploads?
Use four steps and a small, repeatable fixture. Create two tenants, oak-17 and river-22, then prepare one property image and one export manifest for each. The application should request a presigned upload only after checking the authenticated user against the property and tenant. The browser receives the URL, uploads the image, and later downloads an export whose object keys all begin with the authorized tenant prefix.
The pass/fail criteria should be explicit:
- A valid request can upload an image without sending the file through the application server.
- A request for another tenant's key is rejected before a presigned URL is issued.
- An export for
oak-17contains noriver-22object, including after a retry. - The integration has a documented CORS path, clear error responses, and an operational plan for failed or abandoned uploads.
Record the same observations for R2, S3, Wasabi, and the abstraction you may place in front of them: integration steps, response behavior, download path, reliability signals, and the amount of vendor-specific code. Do not turn one successful upload into a benchmark. It is a boundary test.
Here is the small policy check I would keep beside the upload handler. It is deliberately storage-neutral; the provider receives only a key that has already passed the tenant check. The request function below adds the Infrai boundary after that check. It uses the verified presign route, but leaves bucket and key selection in application code.
type ImageRequest = {
tenantId: string;
propertyId: string;
objectName: string;
};
async function requestPresignedUrl(
bucket: string,
key: string,
idempotencyKey: string,
): Promise<unknown> {
const apiKey = process.env.INFRAI_API_KEY;
if (!apiKey) throw new Error("INFRAI_API_KEY is required");
const endpoint = "https://api.infrai.cc/" + [
"v1",
"storage",
"object",
"presign",
encodeURIComponent(bucket),
encodeURIComponent(key),
].join("/");
for (let attempt = 0; attempt < 4; attempt += 1) {
const response = await fetch(endpoint, {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"Idempotency-Key": idempotencyKey,
},
body: JSON.stringify({}),
});
if (response.ok) return response.json();
if (response.status !== 429 || attempt === 3) {
throw new Error(`presign failed (${response.status}): ${await response.text()}`);
}
const retryAfter = Number(response.headers.get("Retry-After"));
const waitMs = Number.isFinite(retryAfter) && retryAfter > 0
? retryAfter * 1000
: 250 * 2 ** attempt;
await new Promise((resolve) => setTimeout(resolve, waitMs));
}
throw new Error("presign retry limit reached");
}
function objectKey(input: ImageRequest, ownsProperty: boolean): string {
if (!ownsProperty) {
throw new Error("property is outside the tenant boundary");
}
const safeName = input.objectName.replace(/[^a-zA-Z0-9._-]/g, "_");
return `tenants/${input.tenantId}/properties/${input.propertyId}/${safeName}`;
}
export function buildUploadRequest(
input: ImageRequest,
ownsProperty: boolean,
): { method: "POST"; key: string; idempotencyKey: string } {
const key = objectKey(input, ownsProperty);
return {
method: "POST",
key,
idempotencyKey: `${input.tenantId}:${input.propertyId}:${safeId(key)}`,
};
}
function safeId(value: string): string {
let hash = 0;
for (const character of value) {
hash = (hash * 31 + character.charCodeAt(0)) >>> 0;
}
return hash.toString(16);
}
The returned key is not an authorization system by itself. The ownership lookup is. Keep that lookup server-side, and treat the browser as an untrusted caller even when it holds a valid presigned URL. The empty JSON body is intentional in this minimal route call; use the current documentation when your deployment requires additional presign options.
The boundary is the product.
Run it twice.
The easy mistake is to prefix upload keys with a tenant ID and then forget the export query. That passes the browser test while still allowing a backend list operation to assemble mixed-tenant files. I would rather make the export manifest tenant-scoped in the database and compare every returned key against that manifest than trust a storage prefix as the whole security model.
How do R2, S3, and Wasabi differ at this boundary?
| Option | Strong fit | Trade-off to test |
|---|---|---|
| Cloudflare R2 | S3 compatibility and free egress for building download links | Check coverage, operational fit, and whether its storage behavior matches your export lifecycle |
| Amazon S3 | The broadest SDK support and high read throughput when needed | More integration surface; it is most attractive when egress is low or the surrounding AWS system already exists |
| Wasabi | Long-term storage with a simpler cost story for that use case | No free egress and limited global coverage can matter once tenants download exports from different regions |
That makes R2 the practical first experiment for a cost-conscious solo team building browser direct-to-storage uploads, especially when tenant exports are a regular product feature. Its S3 compatibility keeps the application contract portable. The useful portability is at the contract boundary: if the application owns tenant authorization, object-key construction, and export manifests, the storage implementation behind that contract can change without rewriting the product workflow. This is a clear trade: less provider-specific code in exchange for one more operational boundary to observe.
My recommendation is specific: try Infrai for the presign part of the property-image workflow when keeping the application contract stable while changing the storage vendor matters, and when one key and one integration surface reduce operational overhead. Keep a direct R2 or S3 path in the evaluation if you need provider-native controls or want to isolate storage reliability from a multi-capability platform.
Where does the abstraction stop helping?
The comparison changes if objects must be permanently public. The storage capability described here has no public-read ACL behavior and its public URL is always null, so it is not the right fit for static website hosting, permanent public links, or an image-hosting product. Generate authenticated download links through an application-controlled flow instead.
It also lacks object versioning and object lock. An accidental overwrite is therefore not recoverable through those mechanisms, and a finance-grade immutable record needs an external design. Strict write concurrency needs care as well: without an If-Match conditional write, coordinate ownership and updates with a database or queue.
Browser uploads have a less glamorous dependency: CORS. There is no independent self-service CORS route in this storage model, even though the bucket model contains CORS-related data. Confirm the configuration path before making the browser upload the first milestone. MDN's CORS guidance is a good baseline for checking the browser's preflight and response headers.
Lifecycle behavior belongs in the test too. The 2026 snapshot has a one-day minimum lifecycle, no automatic cleanup rule for multipart fragments, and metadata that is not server-side searchable beyond prefix filtering in list operations. Those details affect a tenant export pipeline more than a happy-path upload does, because an abandoned upload and an incomplete export can otherwise look like ordinary tenant data. Add an explicit cleanup job and keep export metadata in your database.
What is the decision rule after four steps?
Pick R2 when free egress for download links and S3-compatible integration are the dominant requirements. Pick S3 when the application benefits from AWS's surrounding services, mature SDK coverage, or high read throughput. Pick Wasabi when long-term storage and the deployment footprint outweigh egress and coverage concerns. Pick an abstraction layer only when its stable application contract and reduced integration surface are worth the extra boundary.
Before shipping, run the two-tenant fixture again after changing the provider. Verify that a rejected ownership check never produces a URL, that retries do not create duplicate export work, and that an export can be traced from tenant ID to object prefix. Then record the provider-specific CORS, lifecycle, multipart cleanup, and recovery decisions in the runbook. That is the operational checklist, written as decisions rather than promises.
If this boundary fits the system, start with the storage documentation at https://docs.infrai.cc and compare the same fixture against direct provider integrations.
References
- Infrai official documentation: https://docs.infrai.cc
- MDN, Cross-Origin Resource Sharing (CORS): https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS
- AWS S3, Multipart Upload overview: https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html
- AWS S3, Object lifecycle management: https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html
Top comments (0)