Short answer: treat a presigned download URL as an immutable, short-lived bearer credential. For a signed fintech document, generate it from the exact stored object key, keep the URL byte-for-byte intact, verify the signer and caller clocks, and make its expiry no later than the document's deletion deadline. A 403 then becomes a failure at a specific stage rather than a reason to keep changing signing options.

The governing trade-off is access control versus delivery simplicity. A direct link keeps document bytes out of the application server, but anyone holding that link can generally use it until its authorization expires. If immediate revocation or a fresh policy decision on every download is mandatory, route downloads through an authenticated service instead. Don't try to turn a long-lived presigned URL into a session.

The data flow is small: an authenticated application resolves a tenant-scoped document record, checks its deleteAfter value, asks the storage signer for a GET URL covering that exact key, and returns the link to the browser. The browser uses the returned string without rebuilding it. A deletion worker separately removes the object at the retention deadline; URL expiry is defense in depth, not the deletion mechanism.

What makes a Node.js presigned download URL return a 403 signature mismatch?

Start by locating the first place where observed data differs from signed data. During generation, the common candidates are the HTTP method, bucket or container, region, credentials, object key, signing time, and expiry. During transport, email scanners, JSON handling, redirectors, reverse proxies, and frontend code can alter or expose the URL. During use, the request may arrive after expiry, from a machine with a bad clock, or with headers that no longer match those included in the signature. A correct signature still cannot override a storage access policy that denies the underlying read.

That ordering matters. If the same URL succeeds from a Node.js process but appears to fail in a browser, signature regeneration is a poor first move. Inspect the browser's Network panel for a preflight request and its response, then check the storage CORS policy. CORS is enforced by browsers; it does not explain a 403 reproduced by a server-side request. The MDN CORS guide is the useful boundary here: a cross-origin request can trigger an OPTIONS preflight, and the server must answer with the appropriate access-control headers.

No guessing.

Capture a correlation ID, the document ID, a one-way hash of the object key, the URL issue time, the intended expiry, and the storage request ID when one is returned. Never put the full query string in an application log. It contains the credential you are trying to protect. For the same reason, avoid analytics redirects around download links unless the redirect service is designed to keep query strings out of logs and referrers.

Run the link as issued before changing the signer

This TypeScript probe deliberately does not decode, reconstruct, sort, or append to the signed URL. It reports timing information when the URL uses Signature Version 4 query parameters, checks the expected key suffix for a likely encoding mismatch, and performs the GET with redirects disabled. Run it on a trusted machine with a current Node.js release; pass secrets through the environment and discard the shell history or job environment afterward.

const rawUrl = process.env.SIGNED_URL; const expectedKeySuffix = process.env.EXPECTED_KEY_SUFFIX; if (!rawUrl) { throw new Error("SIGNED_URL is required"); } const inspected = new URL(rawUrl); const issued = inspected.searchParams.get("X-Amz-Date"); const lifetimeSeconds = Number(inspected.searchParams.get("X-Amz-Expires")); function parseBasicIso8601(value: string): number { const match = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/.exec(value); if (!match) throw new Error("Unexpected signing timestamp format"); const [, year, month, day, hour, minute, second] = match; return Date.UTC( Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second), ); } if (issued && Number.isFinite(lifetimeSeconds)) { const issuedAt = parseBasicIso8601(issued); const expiresAt = issuedAt + lifetimeSeconds * 1_000; console.log({ localTime: new Date().toISOString(), issuedAt: new Date(issuedAt).toISOString(), expiresAt: new Date(expiresAt).toISOString(), expiredLocally: Date.now() >= expiresAt, }); } if (expectedKeySuffix) { console.log({ pathname: inspected.pathname, expectedEncodedSuffix: expectedKeySuffix .split("/") .map(encodeURIComponent) .join("/"), }); } const response = await fetch(rawUrl, { method: "GET", redirect: "manual" }); console.log({ status: response.status, requestId: response.headers.get("x-amz-request-id") ?? response.headers.get("x-goog-request-id") ?? "not returned", locationPresent: response.headers.has("location"), }); if (!response.ok) { process.exitCode = 1; } else { await response.body?.cancel(); } 

An expiredLocally result is evidence, but a false result does not clear the clock. Compare the signer host with a trusted time source and record its offset. The signed timestamp comes from the signer, while authorization is evaluated by the storage service. A laptop clock that looks right is irrelevant if signing runs in a container on another host.

The key check is intentionally visual. Suppose the database key is tenant_82/contracts/Loan Offer #7.pdf. The path segments should represent the space and # as encoded data, while the slashes remain separators. Signing one representation and later constructing another can change the canonical path. A fragment marker is especially nasty because everything after an unencoded # belongs to the URL fragment and is not sent in the HTTP request.

Keep the original URL intact.

Do not repair a returned link with decodeURIComponent, concatenate a filename, replace spaces with plus signs, or run the entire URL through a form encoder. Parse a copy for diagnostics if needed, but send the original string. Also verify that the download code still uses GET: a URL signed for GET is not an authorization for HEAD, even when a client library tries HEAD as a metadata check.

Separate signature mismatch, expiry, policy denial, and CORS

"403" is a status, not a diagnosis. Read the provider's structured error response in a trusted environment and retain the request ID, but redact the URL. Signature mismatch points toward canonical request inputs: method, path, query parameters, signed headers, credential scope, or signing key. Expiry points toward issue time, allowed lifetime, temporary credential lifetime, and clock alignment. Policy denial points toward identity policy, resource policy, encryption-key permission, object ownership, or an explicit deny. Those branches have different owners and different fixes. Use controlled comparisons instead of regenerating links at random. First, request the stored key through the trusted backend identity. That distinguishes object lookup and authorization from URL handling. Second, generate one new link and use it immediately from a server-side probe. Third, pass that exact string through the real API response and compare a hash of the before-and-after value. Finally, try the browser and inspect whether it sends GET directly or performs OPTIONS first. This sequence narrows the boundary without printing a credential or weakening a policy. There is a sharp edge around signed headers too: if the signer includes a response override or a content-related header in the canonical request, the caller must preserve the corresponding signed value. Conversely, adding an ordinary unsigned header is not automatically a signature failure. Check the credential's signed-header list rather than applying a blanket "remove all headers" rule.

I'm not sure which boundary failed until those comparisons are available, and neither is anyone looking at one 403 line in a frontend console. The storage request ID, canonical input metadata captured at signing time, and a server-side reproduction settle it. Your mileage may vary on the exact error fields because object storage implementations expose different response bodies, but the stage model stays useful.

Tie every link to the signed document deletion deadline

For retained agreements, the database record should make the lifecycle explicit. Store an opaque document ID, tenant ID, storage key, content hash, creation time, deleteAfter, deletion state, and the policy version that selected the deadline. Keep the object private. The application should resolve the key only after tenant authorization, and the signer should cap URL lifetime at the smaller of the normal download window and the remaining time before deleteAfter.

Consider a contract with deleteAfter = 2026-09-04T16:00:00Z. At 15:52, an application configured for a 15-minute link has only eight minutes of retention left. It must not issue a link valid through 16:07. Better still, stop issuing links shortly before deletion, move the record into a deleting state, remove the object, verify the outcome, and preserve an audit event that contains no document body or bearer URL. Exact grace periods are a policy decision; the invariant is that delivery authorization cannot intentionally outlive retention.

This is where delivery simplicity reaches its limit. A presigned link is not suitable when a compliance rule requires immediate revocation, per-request step-up authentication, a download counter enforced before every byte transfer, or a guaranteed policy check after link issuance. Stick with an authenticated download gateway in those cases, accepting application bandwidth, latency, and operational cost in exchange for a decision on every request. For large files, a hybrid can authorize each request and then issue a very short direct link, but it still has a small bearer window.

Deletion also needs its own evidence. A URL that has expired proves only that this authorization is no longer valid; it does not prove the object was deleted. Conversely, deleting the object makes an otherwise unexpired download link unable to retrieve that object, but replicas, versions, backups, and legal holds may follow separate lifecycle rules. Define what "deleted" means for the system, test that definition, and align it with the retention policy rather than assuming one API response closes the case.

Operate the boundary without leaking the credential

Deployment should fail closed on configuration drift. Validate the signing region, bucket identifier, allowed expiry range, and clock synchronization at startup. Keep signer credentials out of application responses, scope their permissions to the required read operation and key prefix, and rotate them according to the credential system's policy. Temporary credentials add another ceiling: a URL cannot be relied upon beyond the credential that signed it.

Tests should include keys with spaces, +, #, %, Unicode, and nested path segments; a URL used immediately; a URL beyond its configured expiry; a deleted object; a caller from another tenant; and browser preflight behavior. Avoid asserting the whole signed URL because timestamps and signatures are supposed to vary. Assert the resolved key, method, intended expiry, signed-header set, and observable status instead. In a staging environment, run one test with a deliberately offset signer clock so monitoring proves it can identify skew before production users do.

For observability, count outcomes by stage and stable error category, not by full URL. Track signing failures, immediate server-side 403s, browser-only failures, expired-link attempts, policy denials, and deletion lag. Alert on a rise in immediate 403s because those usually indicate deployment or canonicalization drift; treat ordinary post-expiry attempts as product telemetry unless their volume suggests links are reaching users too late. Cost belongs in this review too: direct delivery reduces application egress work, while storage requests, data transfer, logging, version retention, and deletion verification still have billing and operational consequences.

The operational checklist is short enough to keep in prose. Confirm the private object exists under the tenant-scoped key, authorize the document record, calculate expiry against deleteAfter, sign GET once, return the untouched URL, and record only redacted diagnostics. On a 403, reproduce the exact link server-side, classify signature versus time versus policy, then inspect CORS only for a browser-only failure. Finally, verify deletion independently of link expiry.

The rule I would ship is simple: use presigned delivery while a bounded bearer window satisfies the access model, and use a gateway when each download needs a new authorization decision. That choice is about control, not fashion.

References