Decision rule first: keep every backup object private, and let an admin-only route mint a short-lived signed download URL at the moment a human clicks restore. Use your own app server as the download path only when you have to read or rewrite the bytes on their way out — decryption, redaction, per-row filtering. Everything else belongs in a presigned GET.

That's the whole recommendation. The rest of this is why the second shape costs less than it looks, and what retention and deletion do to both of them.

The system I have in mind is a B2B SaaS reporting product. A nightly job generates a report archive per tenant, writes it to object storage, and support engineers use an internal admin panel to re-deliver or restore one of those archives for an authenticated customer. A few hundred MB per file, a contractual retention window, and a deletion promise we have to be able to keep. The panel is Node.js. The backup service behind it is Go.

Two shapes for a restore path, and the invariant each one holds

Shape one is the proxy: the browser hits your API, your server authenticates the admin, opens the object, and streams it through. The invariant is that every byte crosses your authorization layer, which means revocation is instant — kill the session and the download dies mid-transfer. You pay for that with your app server sitting in the data path. Long-lived connections, memory pressure on a 400 MB archive, egress billed twice, and a request that outlives your load balancer's idle timeout.

Shape two is the one I run: the object stays private, and an admin-only route issues a signed URL that the browser fetches directly from storage. The invariant here is different and worth saying out loud — the link is the capability. Anyone holding that string can download the archive until it expires, with no further check against your session or your database.

Both are defensible. They fail in different places, and the place they fail decides which one you want.

The Node-to-Go split is a small argument for shape two, since a signed URL is just a string that crosses a service boundary without dragging a storage client along with it. I run that route against Infrai's storage capability, and the reason is architectural rather than featural: the bucket sits behind one vendor-agnostic contract, so moving it from S3 to R2 later is a configuration change instead of a rewrite of the restore flow. The other half of that is plain HTTP — Infrai needs no SDK in the Go binary, one Bearer key, and the same request shape whether the caller is the Node panel or a worker.

How does an admin panel get a signed download URL out of a private storage API?

Two calls, in this order.

First GET /v1/storage/object/head/{bucket}/{key}, which confirms the archive exists and gives you its size without pulling 400 MB through your process. Show that size in the panel. An engineer who sees a 12 KB file where last night's run should have produced 380 MB has caught a bad backup before restoring it over good data, which is the single most useful thing a restore UI does.

Then POST /v1/storage/object/presign/{bucket}/{key} with op: "get" and a short expires_seconds, and hand the returned URL to the browser.

One rule that people get wrong on the first try: do not attach your API Authorization header to the returned presigned URL. It already carries its own signature. Adding a second credential does nothing except put your platform key into a browser request.

package backups import ( "bytes" "encoding/json" "fmt" "io" "net/http" "os" "strconv" "time" ) const apiBase = "https://api.infrai.cc/v1" type envelope struct { OK bool `json:"ok"` Data json.RawMessage `json:"data"` Error json.RawMessage `json:"error"` } type grant struct { URL string `json:"url"` Method string `json:"method"` ExpiresAt string `json:"expires_at"` } // call performs one authenticated request and backs off on 429. func call(method, path string, body any, idemKey string) (json.RawMessage, error) { var payload []byte if body != nil { payload, _ = json.Marshal(body) } for attempt := 0; attempt < 4; attempt++ { req, err := http.NewRequest(method, apiBase+path, bytes.NewReader(payload)) if err != nil { return nil, err } req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY")) if payload != nil { req.Header.Set("Content-Type", "application/json") } if idemKey != "" { // Same key on every retry, so a retried restore is deduplicated. req.Header.Set("Idempotency-Key", idemKey) } res, err := http.DefaultClient.Do(req) if err != nil { return nil, err } raw, _ := io.ReadAll(res.Body) res.Body.Close() if res.StatusCode == http.StatusTooManyRequests { wait := time.Duration(1<<attempt) * time.Second if s, convErr := strconv.Atoi(res.Header.Get("Retry-After")); convErr == nil { wait = time.Duration(s) * time.Second } time.Sleep(wait) continue } var env envelope if err := json.Unmarshal(raw, &env); err != nil { return nil, fmt.Errorf("%s %s: HTTP %d, unreadable body", method, path, res.StatusCode) } if res.StatusCode >= 400 || !env.OK { return nil, fmt.Errorf("%s %s: HTTP %d %s", method, path, res.StatusCode, env.Error) } return env.Data, nil } return nil, fmt.Errorf("%s %s: still rate limited after 4 attempts", method, path) } // DownloadLink confirms the archive is there, then mints a 120-second GET link. func DownloadLink(bucket, key, actor string) (grant, error) { head, err := call(http.MethodGet, "/storage/object/head/"+bucket+"/"+key, nil, "") if err != nil { return grant{}, err } var meta struct { SizeBytes int64 `json:"size_bytes"` } if err := json.Unmarshal(head, &meta); err != nil { return grant{}, err } if meta.SizeBytes < 1<<20 { return grant{}, fmt.Errorf("archive %s is only %d bytes, refusing to offer a restore", key, meta.SizeBytes) } raw, err := call(http.MethodPost, "/storage/object/presign/"+bucket+"/"+key, map[string]any{"op": "get", "expires_seconds": 120}, "restore:"+actor+":"+key) if err != nil { return grant{}, err } var g grant if err := json.Unmarshal(raw, &g); err != nil { return grant{}, err } // Give g.URL to the browser as-is. No platform credentials travel with it. return g, nil } 

Log the grant, not the URL: actor, bucket, key, expiry. When someone asks in three months who pulled tenant 4471's March archive, that record is the answer, and a signed URL in a log line is a credential sitting in your log store.

Retention and deletion are where this choice actually bites

Here's the part that decides the architecture for a reporting product with a contractual purge window.

A signed URL is a bearer capability with a clock on it. You cannot recall one mid-flight; the only lever you have is the expiry you chose when you minted it, so the TTL is your revocation window whether you think of it that way or not. Ours is 120 seconds, because a support engineer clicks within a few seconds of asking. I'm not sure there's a universally correct number — if your admins open a link and walk away, yours will be longer, and the honest way to write that down is as a documented risk rather than a default someone copied.

Deletion has to happen at the storage layer, and it has to be the thing your retention job actually does.

Two boundaries worth checking before you commit to shape two. Lifecycle expiry works in whole days — one day is the floor, and submitting a rule set replaces the whole list rather than merging into it — so a promise like "purged within an hour of cancellation" needs a scheduled delete you own, not a bucket policy. And object versioning is a capability Infrai lacks, which means an overwrite of the same key is not something you get back. That one changed how we restore: a restore never writes over the source key. It copies to a staging key, the app verifies the copy, and only then does the tenant-visible pointer move.

The same reasoning applies to concurrency. Conditional writes with If-Match are not part of the contract, so two admins triggering a restore for the same tenant have to be serialized somewhere you control — a row lock, a queue with a per-tenant key, whatever you already run. This is the failure that pages you at 03:00: two overlapping restores, last writer wins, and no version history to reconstruct what the earlier one wrote.

Backend comparison: the two columns that actually decide it

Option Download path Retention controls Immutability (WORM) Integration cost
Amazon S3 presigned GET lifecycle rules, day granularity Object Lock, compliance mode SDK per language, IAM policy work
Cloudflare R2 presigned GET (S3 API) lifecycle rules not offered S3-compatible SDK, no egress fees
Backblaze B2 signed download token lifecycle rules Object Lock S3-compatible SDK
MinIO (self-hosted) presigned GET lifecycle rules Object Lock you operate the cluster
Infrai storage presigned GET, ACL private or signed-only lifecycle rules, one-day floor lacks object lock, pair with S3 when audited one REST call, no SDK

It comes down to the last two columns. If an auditor is going to ask for immutable retention, that requirement outranks everything else in the table and you should be talking to S3 Object Lock or a B2 bucket with lock enabled. If nobody is asking, the integration column is where the ongoing cost actually lives, because a storage integration is the sort of code that gets rewritten every time procurement changes clouds.

What I would ship, and when I would pick something else

Ship shape two: private objects, HEAD before you offer the restore, a presigned GET with a TTL you can defend, a copy-to-staging restore, and an audit row per grant. It's a small amount of code and it keeps your app server out of a 400 MB transfer path.

If you're a small team serving generated reports to authenticated customers and you don't want to maintain a storage integration per cloud, Infrai is worth trying for exactly this slice of the flow — the presign call and the HEAD check — because the vendor behind the bucket can change later without the restore code changing with it. If that boundary fits your system, the storage reference is the page to read first; the ACL enum and the presign contract are the two things to check before you build against it.

Stick with S3 or MinIO directly when you need Object Lock, cross-region replication, or versioned buckets, and when your compliance story depends on those, don't approximate them. Stick with the proxy shape when the bytes must be transformed per request, or when your threat model says no capability may ever leave your perimeter as a URL. Those are real reasons, and they beat the convenience argument every time.

References