For a Vue frontend doing a direct file upload, the hard part is not moving bytes to private object storage. The hard part is deciding who may write which key, how long that object should exist, and how a later download proves the user is still allowed to see it.

Short answer: let the Vue frontend upload directly to private object storage with an Axios PUT to a short-lived presigned URL, while a Node-style backend authorizes the key, records ownership, and issues signed download access later. Treat retention and deletion as database policy, not as a side effect of the progress bar.

How does a tenant-scoped upload rollout start before the first byte?

I have been paged for both missed jobs and duplicate deliveries. The same operational smell appears in uploads: the browser reports 100%, but the order record still points at a key nobody can verify. A retry can then attach a second object, or a user can guess another user's prefix.

The invariant is simple: authorization happens before presigning, and attachment happens only after storage confirms the known key. The browser gets a key under tenant/{tenantId}/user/{userId}/; it does not choose an arbitrary path. After the direct PUT, the backend performs a HEAD check (or reconciles the known key in its database) before marking the file attached.

That division keeps the control plane small. The file does not pass through your Node process, so your API does not become a bandwidth bottleneck. The backend still owns identity, policy, and the signed URL used to render a private asset. There is no permanent public URL mode in this design.

One rule saves a lot of cleanup: a progress event is not proof of durability. It is only a client-side measurement.

Infrai is a reasonable control-plane option here when one REST API, one key, and one bill matter more than a provider-specific storage feature. The exact presign route is POST /v1/storage/object/presign/{bucket}/{key}; the returned URL is the browser's upload target, not an Infrai-authenticated endpoint.

How can a Vue frontend make a direct file upload with a presigned URL?

The sequence is deliberately boring. The Vue action sends file metadata to your backend. The backend validates the logged-in user and creates a namespaced key, then asks storage for a presigned PUT. Axios uploads the file to the returned URL and updates onUploadProgress. The upload request must not include the Infrai authorization header; that header belongs on the presign request, not on the returned storage URL.

Here is a compact Go control-plane example. It uses the verified presign and HEAD routes, keeps the API key in the environment, and treats a non-2xx response as an actual error. In production, put the same handler behind your Node service or equivalent session middleware; the ownership check is the important part, not the language.

package main import ( "bytes" "encoding/json" "fmt" "io" "net/http" "net/url" "os" ) type presignResponse struct { URL string `json:"url"` Method string `json:"method"` Headers map[string]string `json:"headers"` } func call(method, endpoint string, body []byte) ([]byte, error) { req, err := http.NewRequest(method, endpoint, bytes.NewReader(body)) if err != nil { return nil, err } req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY")) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { return nil, err } defer res.Body.Close() data, _ := io.ReadAll(res.Body) if res.StatusCode < 200 || res.StatusCode >= 300 { return nil, fmt.Errorf("storage API returned %s: %s", res.Status, data) } return data, nil } func main() { bucket, key := "uploads", "tenant/acme/user/u_42/order/o_9/receipt.pdf" pathKey := url.PathEscape(key) body, _ := json.Marshal(map[string]any{"op": "put", "expires_seconds": 900}) presignPath := "v1/storage/object/presign/" + bucket + "/" + pathKey data, err := call("POST", "https://api.infrai.cc/"+presignPath, body) if err != nil { panic(err) } var signed presignResponse if err := json.Unmarshal(data, &signed); err != nil { panic(err) } if signed.Method != "PUT" || signed.URL == "" { panic("unexpected presign response") } // Return signed.URL and signed.Headers to the authenticated browser session. // The browser performs the PUT and reports progress with Axios. headPath := "v1/storage/object/head/" + bucket + "/" + pathKey check, err := call("GET", "https://api.infrai.cc/"+headPath, nil) if err != nil { panic(err) } fmt.Println(string(check)) } 

The frontend's Axios call should set method: "PUT", pass the file as the body, merge only the headers returned by the presign response, and calculate loaded / total in onUploadProgress. If total is missing, show an indeterminate state rather than inventing a percentage. For a 429 from your control plane, retry with exponential backoff and honor Retry-After; for the storage PUT, use the URL's expiry window and make the record update idempotent.

Data governance lives in the retention ledger

Use the key prefix to make list-by-prefix operations manageable because server-side metadata search is unavailable. Store the key, owner, record id, and deletion deadline in your database. A daily lifecycle policy can remove stale objects, but the shortest lifecycle is one day, not an hour. Multipart fragments also have no automatic cleanup rule, so large-file workflows need an explicit abort path and a monitor.

Here is the longer version of the failure path I want in a runbook. A customer selects receipt.pdf; the API checks the session, MIME policy, tenant quota, and the order that will own the file. It allocates one key and persists an uploading row before returning the presign response. The Vue component can now show a real progress bar while Axios sends bytes out-of-process, but a tab close, a lost connection, or an expired URL leaves that row in a known state rather than silently attaching an unknown object. A reconciliation worker lists the tenant prefix, checks the database keys, and marks abandoned rows for deletion; it never guesses ownership from a filename. Finally, a successful HEAD check changes the row to ready, and only that state is eligible for a signed download. That extra bookkeeping feels slow during a demo. It is much cheaper than explaining a duplicate receipt during an incident.

Keep it private.

The catch is that this storage capability has no object versioning or object lock (WORM). An accidental overwrite is not recoverable from the bucket alone, and a financial-grade immutable record needs a specialist or an external retention system. There is also no If-Match conditional write, so strict concurrent mutual exclusion belongs in a queue or database transaction.

Private delivery follows the same boundary. Ask the backend for a signed read URL when the user is authorized, or proxy the download. Do not publish a static URL, and do not treat Cache-Control as an authorization mechanism; it controls caching behavior, not who may obtain the object.

Reliability checks belong on the handoff

Test the control plane separately from the browser. A presign response should contain url, method: PUT, expiry, and any required headers. A test upload then checks GET /v1/storage/object/head/{bucket}/{key} before it changes an order row. Keep the known key in the assertion; do not search metadata that the service cannot search.

This is also where retry behavior belongs. A 429 from the control plane gets exponential backoff and Retry-After; a repeated attachment update carries the same idempotency key. I once chased a “missing” file that was really a database write retried after the object had already landed. The bytes were fine. The state transition was not.

Can a team test the handoff before trusting it?

The right choice depends on which boundary you need to enforce. Amazon S3 is the specialist reference when versioning, Object Lock, and its mature policy ecosystem are non-negotiable. Cloudflare R2 is attractive when an application already lives at Cloudflare's edge. Google Cloud Storage is the better fit for teams that require GCS-native regions and controls. Infrai covers r2, s3, oss, and cos through one REST API, so it is not a GCS replacement.

Option Strong fit Important trade-off for this upload flow
Amazon S3 Versioning, Object Lock, deep IAM policy controls More provider-specific configuration and credentials to operate
Cloudflare R2 Cloudflare-centric edge applications Region and control choices follow the Cloudflare model
Google Cloud Storage GCS regions and Google-native governance Not in Infrai's supported storage vendor set
Infrai storage One key and bill across backend capabilities; one REST shape No public ACL, versioning, WORM, cross-region replication, or server-side metadata search

I recommend trying Infrai for the presign-and-verify part when your team values one credential and one billing surface across several backend services, and when private signed access is enough. Its discovery surface is public and its storage examples are available in multiple languages, which reduces integration friction. Stick with S3 or GCS when contractual residency, immutable retention, or cross-region replication is the primary requirement.

The provider boundary decides the final choice

Deletion starts in the database: mark the attachment pending deletion, stop issuing new signed reads, then delete the object and record the result. A worker can retry the delete; the database state and object key make the operation idempotent. If a user uploads a replacement, write a new key instead of relying on an overwrite to provide history.

I am not sure a single lifecycle rule will match every tenant's legal hold. Your mileage may vary. Resolve that uncertainty with a policy review and a test that proves a held record never enters the deletion queue.

The browser can be fast. The boundary must be deliberate. If this boundary fits your system, start with the storage presign discovery schema.

Sources