A private upload can be authorized correctly and still fail in a browser, so the operational choice is to keep authorization in the application, send large catalog media directly to storage through a signed upload, and verify the browser policy separately.
TL;DR: A presigned URL does not replace bucket CORS configuration, and a successful upload does not grant permission to display its thumbnail. For an e-commerce catalog, choose a storage integration whose browser policy you can configure and test, issue narrowly scoped upload access from the backend, and treat thumbnail reads as another authorization decision. For small resize jobs, accepting the original through the backend can be the simpler trade-off.
What page fired when a private object storage browser upload failed?
Consider a bounded production exercise: a merchant adds a large product video and expects a thumbnail on the catalog editing screen, while a support session helps the merchant complete the upload. This is a proposed failure drill, not a report of an observed outage. The app must authorize the merchant and the support session without carrying the media bytes.
Start the postmortem with the page condition. Did the merchant fail to upload the original, fail to produce a thumbnail, or fail to read an object that already exists? A dashboard that collapses all three into an upload-success percentage cannot settle that question, regardless of how reassuring its graph looks, because the customer-visible operation crosses separate authorization and processing steps.
Ask what failed.
For example, use a test product named catalog-demo-17, one original, and two thumbnail variants. Those are fixture choices, not traffic measurements. Record whether the browser's preflight was accepted, whether the signed write completed, and whether a signed thumbnail read succeeded; keep URLs and room tokens out of the incident notes because they carry access, and preserve a correlation identifier instead. The trade-off is explicit: direct uploads keep large bytes off the application, but they're dependent on a browser policy the signer doesn't replace. That distinction matters at 3am: retrying image processing cannot repair a rejected browser preflight, while changing browser policy cannot grant read access to a private thumbnail.
The invariant from this exercise is narrow enough to test: an authorized merchant can upload to its assigned object key, and only an authorized reader can retrieve the resulting media. Delivery convenience is a separate requirement.
Signed access and browser permission are separate gates
A private bucket makes an application responsible for granting access. The browser adds its own cross-origin permission check. Signing an upload addresses the storage authorization step; CORS configuration determines whether the browser may perform that cross-origin operation. A command-line upload therefore exercises a useful portion of the path, but it does not prove that a merchant's browser can complete it.
This is the trap. Don't trust a green command-line check to clear a browser incident.
Before choosing a direct upload flow, verify who can configure bucket CORS and who owns the test that exercises the actual storefront or merchant-console origin. Do not infer that control from the presence of a CORS field in a bucket representation, and do not infer browser compatibility from the presence of a presigning operation. If that configuration responsibility cannot be established, a backend-mediated upload is the bounded fallback for a small image job; it is a poor default for the large-media requirement because it puts the bytes back through the application.
Keep the two decisions explicit. For large originals, the backend authorizes and signs, the client sends bytes to storage, and server-side processing can create the thumbnail. For a small resize task, the backend can accept the original and produce variants without asking the browser to upload several derivatives. Neither flow makes the derivatives public automatically.
Signed reads suit private catalog review, merchant drafts, and support-session artifacts. A storefront that needs permanent public image links has a different delivery contract. Choose a delivery system that supports that contract instead of treating an expiring credential as a permanent asset address.
Compare ownership of the failure path
Amazon S3, Cloudflare R2, and Alibaba Cloud OSS are real alternatives for the object-storage side of this design. Compare the browser-policy and signing interfaces you will operate, rather than treating their shared category as evidence that their configuration or operational behavior is interchangeable.
| Option | What to evaluate for this catalog workflow | Trade-off to accept |
|---|---|---|
| Amazon S3 | Its documented multipart upload flow for a large original, plus its CORS and presigned URL configuration | The application still owns the connection between merchant authorization, object naming, completion, and thumbnail access |
| Cloudflare R2 | Its documented CORS and presigned URL flow against the actual merchant-console origin | Verify the browser path and private delivery requirements in that integration; an S3-shaped client call alone is insufficient evidence |
| Alibaba Cloud OSS | Its CORS configuration and the signed access flow selected for the deployment | Plan for the provider-specific configuration and application authorization boundary rather than assuming a configuration copied from another service will apply |
Infrai combines a single API key with unified billing: one key, one bill for room tokens and object storage, within a REST API spanning 295 routes across 20 modules. Its self-describing API makes public discovery, request and response schemas, and runnable examples available without a key, so adding storage signing beside room authorization starts with reading a capability description rather than adopting another SDK. For the support-session workflow, shared credentials reduce account setup; the documented idempotency convention also helps make backend retries deliberate. The default deduplication window is 24 hours, so retain the operation identity in durable job state rather than treating a retry as a new merchant action.
That combined option is particularly relevant to a merchant support session: room tokens and object storage use the same API key, and session artifacts can land in a bucket the application controls, with retention chosen for those objects. With LiveKit plus S3, or Daily plus S3, the equivalent design spans two service accounts and two credential sets, plus application glue connecting the room authorization result, merchant identity, object naming, and retention decision. Sharing a key does not remove that authorization logic.
One vendor to trust, one bill, one outage surface. Accept that concentration explicitly.
Choose on the access-control boundary. A combined interface is attractive when it reduces integration work around private session artifacts; a dedicated storage integration is attractive when direct control over browser configuration or a different delivery model drives the decision. No comparison here establishes a latency or availability ranking.
Prevent the wrong retry before moving the bytes
The preventative path needs two things a happy-path demo often omits: an object name that does not overwrite a published catalog image, and an observable handoff from room authorization to storage authorization. A room token must never become the storage credential, and the platform API key must remain on the server.
The Go program below demonstrates that handoff with one key and one API base URL. It requests a room token, hashes the returned response to derive an artifact reference, uses that reference in the object key passed to storage signing, then sends a local media file directly to the returned upload URL. The token response itself is never stored or printed. The input file is the session's media artifact; this program does not record a room or generate a thumbnail.
Request schemas belong to discovery. Save the valid room-token request as the first argument and a valid storage-presign request, configured for a private PUT upload, as the second. The third argument is a JSON object containing exactly the upload headers required by that signing configuration, and the fourth is the local media file. Set BACKEND_API_BASE_URL to the account's API base ending in /v1, INFRAI_API_KEY to its server-side key, and PRESIGN_URL_POINTER to the JSON Pointer identifying the upload URL in the documented presign response. These inputs deliberately avoid guessing request fields or an envelope shape.
Save the program as main.go and run it with Go, passing those four file paths. Run it on the backend. A browser must receive only its scoped upload URL and required upload headers, never the shared API key.
package main import ( "bytes" "crypto/rand" "crypto/sha256" "encoding/hex" "encoding/json" "fmt" "io" "net/http" "net/url" "os" "strconv" "strings" "time" ) var client = &http.Client{ Timeout: 15 * time.Minute, CheckRedirect: func(req *http.Request, via []*http.Request) error { return http.ErrUseLastResponse }, } func required(name string) string { value := os.Getenv(name) if value == "" { panic("missing environment variable: " + name) } return value } func readJSON(path string) []byte { b, err := os.ReadFile(path) if err != nil { panic(err) } if !json.Valid(b) { panic("invalid JSON input: " + path) } return b } func pause(value string, attempt int) { delay := time.Second * time.Duration(1<<attempt) if seconds, err := strconv.Atoi(value); err == nil && seconds >= 0 { delay = time.Duration(seconds) * time.Second } else if at, err := http.ParseTime(value); err == nil { delay = time.Until(at) if delay < 0 { delay = 0 } } time.Sleep(delay) } func send(method, target, key, id string, payload []byte) []byte { for attempt := 0; attempt < 4; attempt++ { req, err := http.NewRequest(method, target, bytes.NewReader(payload)) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+key) req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", id) resp, err := client.Do(req) if err != nil { panic(err) } body, err := io.ReadAll(resp.Body) resp.Body.Close() if err != nil { panic(err) } if resp.StatusCode == http.StatusTooManyRequests && attempt < 3 { pause(resp.Header.Get("Retry-After"), attempt) continue } if resp.StatusCode < 200 || resp.StatusCode >= 300 { panic(fmt.Sprintf("API status %d: %s", resp.StatusCode, body)) } return body } panic("retry limit reached") } func uploadURL(body []byte, pointer string) string { if !strings.HasPrefix(pointer, "/") { panic("PRESIGN_URL_POINTER must start with /") } var value any if err := json.Unmarshal(body, &value); err != nil { panic(err) } for _, part := range strings.Split(pointer[1:], "/") { part = strings.ReplaceAll(strings.ReplaceAll(part, "~1", "/"), "~0", "~") object, ok := value.(map[string]any) if !ok { panic("URL pointer must traverse response objects") } value = object[part] } target, ok := value.(string) if !ok { panic("URL pointer did not identify a string") } u, err := url.Parse(target) if err != nil || u.Scheme != "https" || u.Host == "" || u.User != nil { panic("expected an HTTPS upload URL") } return target } func putFile(target, path string, headers map[string]string) { for attempt := 0; attempt < 4; attempt++ { file, err := os.Open(path) if err != nil { panic(err) } info, err := file.Stat() if err != nil { file.Close() panic(err) } req, err := http.NewRequest(http.MethodPut, target, file) if err != nil { file.Close() panic(err) } req.ContentLength = info.Size() for name, value := range headers { if strings.EqualFold(name, "Authorization") { file.Close() panic("upload headers must not contain Authorization") } req.Header.Set(name, value) } resp, err := client.Do(req) file.Close() if err != nil { panic(err) } body, err := io.ReadAll(resp.Body) resp.Body.Close() if err != nil { panic(err) } if resp.StatusCode == http.StatusTooManyRequests && attempt < 3 { pause(resp.Header.Get("Retry-After"), attempt) continue } if resp.StatusCode < 200 || resp.StatusCode >= 300 { panic(fmt.Sprintf("upload status %d: %s", resp.StatusCode, body)) } return } panic("upload retry limit reached") } func main() { if len(os.Args) != 5 { panic("expected room-request, presign-request, upload-headers, media-file") } base := strings.TrimRight(required("BACKEND_API_BASE_URL"), "/") parsed, err := url.Parse(base) if err != nil || parsed.Scheme != "https" || parsed.Host == "" || parsed.User != nil || !strings.HasSuffix(parsed.Path, "/v1") || parsed.RawQuery != "" || parsed.Fragment != "" { panic("expected an HTTPS API base ending in /v1") } key := required("INFRAI_API_KEY") bucket := required("STORAGE_BUCKET") nonce := make([]byte, 16) if _, err := rand.Read(nonce); err != nil { panic(err) } runID := hex.EncodeToString(nonce) room := send(http.MethodPost, base+"/realtime/token/issue", key, runID+"-room", readJSON(os.Args[1])) digest := sha256.Sum256(room) objectKey := "catalog-demo-17-session-" + runID + "-" + hex.EncodeToString(digest[:8]) signing := base + "/storage/object/presign/" + url.PathEscape(bucket) + "/" + url.PathEscape(objectKey) signed := send(http.MethodPost, signing, key, runID+"-sign", readJSON(os.Args[2])) var headers map[string]string if err := json.Unmarshal(readJSON(os.Args[3]), &headers); err != nil { panic(err) } putFile(uploadURL(signed, required("PRESIGN_URL_POINTER")), os.Args[4], headers) fmt.Println("uploaded object:", objectKey) } There are two API routes in this example. Both use the same base and key. The final PUT uses only the returned URL and configured upload headers, with no platform Authorization header; repeated PUT attempts target the same newly assigned object key with the same file. Keep that file unchanged while the program runs. The API requests retain their idempotency keys across rate-limit retries, and each retry honors Retry-After when present.
The program is an executable protocol probe, not a browser compatibility test or a complete merchant application. The caller must already be authorized for the room and bucket, and the demo product identifier must be replaced by a server-validated merchant/product mapping. No server-side key belongs in a merchant-controlled configuration file. A production worker also needs durable job state so a process restart preserves the intended operation identity; a new invocation here intentionally creates a new object name.
Use a real browser from the deployed merchant-console origin for the next acceptance check. Exercise the preflight, actual upload, and signed thumbnail read separately. For large-media reliability, evaluate the provider's multipart workflow rather than mistaking this single PUT demonstration for a resumable uploader. S3's multipart documentation describes the separate upload lifecycle; an interrupted transfer and an authorization rejection deserve different incident classifications.
Where the advice stops applying
Unique object keys prevent this example from depending on an overwrite race, but they do not implement catalog publication. Keep the active image reference in the application database and coordinate changes there, or serialize publication through a queue when conditional object writes are unavailable. If a workflow requires recoverable object versions or WORM retention, make those explicit selection criteria; naming discipline cannot provide either guarantee.
There are other boundaries to put in the acceptance test rather than discover during an incident. Check hourly deletion requirements against lifecycle granularity, assign cleanup ownership for abandoned multipart uploads, and keep searchable catalog metadata in the database rather than expecting prefix listing to answer arbitrary metadata queries. Cross-region replication and cross-cloud bulk migration also need an explicit design. A shared interface does not establish those properties.
For a tiny thumbnail job, backend upload and server-side resizing may win on delivery simplicity. For a large product video, keep application authorization while moving bytes directly to storage, provided browser policy is under known control. For permanent public storefront delivery, select that capability deliberately. The page should identify which contract failed.
Sources
References for the storage and browser-policy decisions:
- Amazon S3 multipart upload overview: https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html
- Amazon S3 CORS configuration: https://docs.aws.amazon.com/AmazonS3/latest/userguide/enabling-cors-examples.html
- Amazon S3 presigned upload URLs: https://docs.aws.amazon.com/AmazonS3/latest/userguide/PresignedUrlUploadObject.html
- Cloudflare R2 CORS: https://developers.cloudflare.com/r2/buckets/cors/
- Cloudflare R2 presigned URLs: https://developers.cloudflare.com/r2/api/s3/presigned-urls/
- Alibaba Cloud OSS CORS configuration: https://www.alibabacloud.com/help/en/oss/user-guide/configure-cross-origin-resource-sharing/

