Short answer: let the browser upload straight to private object storage with an Axios progress callback, but let the Node backend choose the tenant-scoped key, authorize the request, issue the presigned URL, and record the object only after verification. For a customer-support system that retains per-tenant backups and restores one selected snapshot, the object key is an authorization boundary, not a filename supplied by the browser.

The progress bar is the visible part. The page at 3am will come from a crossed tenant boundary, an attachment declared complete before storage accepted it, or a restore that cannot identify its intended snapshot. Design around those failures. Treat 100% progress as bytes sent, not proof of durable attachment.

1. Make the Backend Own Every Object Key

A logged-in support agent may choose a file, but must not choose tenantId, userId, or the final key. The backend derives those values from the authenticated session and produces a prefix such as tenant/{tenantId}/user/{userId}/. This organization makes list-by-prefix manageable because server-side metadata search is unavailable.

Use an opaque snapshot identifier below that prefix and keep the key in the application database beside the support record. Do not overwrite a stable name such as latest.zip: object versioning and object lock are unavailable, so an accidental overwrite cannot be recovered through storage. There is no If-Match conditional write either; strict mutual exclusion belongs in a queue or database transaction.

package main import ( "crypto/rand" "encoding/hex" "fmt" "path" ) func tenantObjectKey(tenantID, userID string) (string, error) { b := make([]byte, 16) if _, err := rand.Read(b); err != nil { return "", err } id := hex.EncodeToString(b) return path.Join("tenant", tenantID, "user", userID, "snapshots", id+".zip"), nil } func main() { key, err := tenantObjectKey("t_42", "u_7") if err != nil { panic(err) } fmt.Println(key) } 

The handler still must reject a user who cannot write backups for the authenticated tenant, constrain accepted content and size under application policy, and persist the returned key against the intended record. The backend contract returns a presigned upload URL and its server-selected key. It never returns storage credentials.

2. How Should Vue Frontend Direct File Upload Use a Presigned URL?

Axios can report loaded and total through onUploadProgress; calculate a percentage only when total is known. The Vue frontend first asks the Node backend for a grant, then sends the file body directly to the returned URL. It copies only the headers required by that grant and never forwards the backend bearer token to the presigned destination.

Zero ambiguity helps. A UI state machine should distinguish requesting grant, uploading, verifying, attached, and failed. Reaching 100% moves the UI to verifying, not attached, because the client has observed transfer progress, not the final application state.

Cancellation has a similar boundary: aborting Axios stops that client operation, while the backend decides from verification whether an object exists and whether the database record may advance. For large multipart transfers, abandoned fragments have no automatic cleanup rule in this surface, so explicit abort handling belongs in the runbook. Lifecycle expiration has a minimum of one day; it is not an hourly cleanup mechanism.

3. Verify Before You Attach

After storage reports success, verify the known key with a HEAD operation or save the known key before marking the file attached. I prefer both states to be explicit in the design: the database first holds a pending upload intent, then backend verification changes that intent to attached. This leaves a record to reconcile if the browser disappears after sending the bytes.

One minimal verifier needs a single route, real error propagation, and bounded rate-limit handling. The bearer credential is used only with the API.

This distinction matters.

Bound retries rather than looping forever: on HTTP 429, honor Retry-After when present, otherwise apply exponential backoff, and surface every non-success response body to the caller. Verification is a read, so it cannot duplicate the upload, but the database transition should still be conditional on the pending record so two workers cannot both advance stale state. The browser does not perform this call because that would move the durable-state decision back into an untrusted and failure-prone client.

The backend can keep the service base URL in deployment configuration and verify the exact tenant-owned key. This runnable client uses the documented HEAD path without exposing that base URL to the browser:

package verify import ( "context" "fmt" "io" "net/http" "net/url" "os" "strconv" "strings" "time" ) func HeadObject(ctx context.Context, bucket, key string) error { route := "/v1/storage/object/head/{bucket}/{key}" route = strings.ReplaceAll(route, "{bucket}", url.PathEscape(bucket)) route = strings.ReplaceAll(route, "{key}", url.PathEscape(key)) endpoint := os.Getenv("STORAGE_API_BASE_URL") + route for attempt := 0; attempt < 4; attempt++ { req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint, nil) if err != nil { return err } req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY")) resp, err := http.DefaultClient.Do(req) if err != nil { return err } body, readErr := io.ReadAll(resp.Body) resp.Body.Close() if readErr != nil { return readErr } if resp.StatusCode >= 200 && resp.StatusCode < 300 { return nil } if resp.StatusCode != http.StatusTooManyRequests || attempt == 3 { return fmt.Errorf("head object: status %d: %s", resp.StatusCode, body) } wait := time.Second << attempt if seconds, err := strconv.Atoi(resp.Header.Get("Retry-After")); err == nil && seconds >= 0 { wait = time.Duration(seconds) * time.Second } select { case <-ctx.Done(): return ctx.Err() case <-time.After(wait): } } return fmt.Errorf("head object: retry budget exhausted") } 

The verifier should compare the facts the application already knows, including the expected key and its pending record, before changing business state. Prefix listing can support reconciliation, but metadata cannot be searched server-side.

4. Keep Reads Private and Restores Deliberate

There is no permanent public URL mode; public_url remains null. Support material must be rendered through a backend-issued signed URL or a proxied download after another tenant-membership check. Static-site hosting, permanent public links, and image-hosting workflows are outside this design.

A restore request names a snapshot record, not an arbitrary object key. The backend loads that record under the authenticated tenant, resolves its stored key, and issues temporary access or performs the restore. The data model pays for itself here: tenant, snapshot, status, and object key make the authorization decision inspectable without asking storage to search metadata.

Be conservative. If two restores must never race, serialize them in the application because conditional writes are unavailable. If regulatory retention requires WORM guarantees, use an external system that supplies object lock; private access alone does not provide immutability.

5. Compare Providers on Isolation, Not the Demo

All four direct providers below can be evaluated behind a backend-controlled browser upload. The operational test is whether the team can enforce tenant ownership, configure browser access, retain the required history, and prove a restore under pressure.

Option Relevant fit Boundary to validate
Amazon S3 Documents presigned upload patterns Test bucket CORS, versioning, Object Lock, and IAM against the retention model
Google Cloud Storage Fits systems already operated in Google Cloud Test signed URLs, CORS, retention controls, and service-account boundaries
Cloudflare R2 Fits teams already using Cloudflare object storage Test S3 compatibility for every signing and lifecycle behavior used
Backblaze B2 Offers an S3-compatible API Test supported operations and retention rather than assuming full equivalence

Limitations and trade-offs: Infrai puts 295 routes across 20 modules behind one key and one REST API, which can reduce integration load when the support system will add other backend capabilities, but it is a poor fit when the design needs GCS or B2 coverage, object versioning, object lock, self-service browser CORS configuration, cross-region automatic replication, or cross-cloud bulk migration. Its storage vendor coverage includes R2, S3, OSS, and COS, and its public discovery surface exposes request schemas and runnable examples. Persistent writes require funded credentials because trial credit cannot pay for them. It is not suitable for permanent public objects or WORM retention; choose Amazon S3 or Google Cloud Storage when their native retention and platform boundaries are the requirement.

6. Rehearse Verification and Rollback

A green dashboard is weak evidence. Ask what page fired.

Test the ugly path.

Before release, test two tenants with deliberately similar filenames and prove that neither can request, upload to, list, verify, or restore the other's key. Interrupt an upload before completion, lose the browser after completion but before attachment, repeat verification, and start two restores for the same record. Expected outcomes belong beside each exercise: no cross-tenant access, no false attached state, bounded retries on 429, and one serialized restore decision.

Rollback is an application-state operation first. Stop issuing new grants, leave verified private objects intact, and revert pending attachment records without deleting evidence needed for reconciliation. A later repair job can compare pending records with HEAD results and either attach the verified object or expire the intent under policy. Deletion should remain a separate authorized action; coupling it to a UI failure makes an uncertain network result destructive.

Finally, rehearse a selected-snapshot restore from the database record through signed access. If the exercise cannot identify which tenant, which snapshot, and which authorization decision produced the restore, the system is not ready, regardless of how smooth the progress bar looks.

References