Share an S3 file with a link that expires, from your browser

by 11 min read
Opndrive Guides title card: Share an S3 file with a link that expires, from your browser
On this page

You want to share a file from S3 with a link that stops working after a set time, without making the bucket public or writing code. This guide is for beginners storing files in Amazon S3, Cloudflare R2, Backblaze B2, or MinIO who have never created a presigned URL (a link that carries its own time-limited permission). Open the file’s More actions menu in Opndrive, choose Share, pick an expiry up to 7 days, and copy the link (Opndrive’s share-link update, 2026-11-18).

Key takeaways

  • An S3 share link is a presigned URL: anyone holding it can open the file many times until expiry (AWS S3 presigned URLs).
  • Links last up to 7 days (604,800 seconds) on S3, R2, and MinIO. The Amazon S3 console stops at 12 hours (AWS S3 sharing docs, Cloudflare R2 docs, minio-go).
  • There is no per-link revoke. Stopping a link early requires invalidating the signing credentials, such as removing the IAM (Identity and Access Management) principal’s permissions or deactivating a permanent access key (AWS Prescriptive Guidance). Pick the shortest expiry that works.
  • Your bucket needs a CORS rule allowing requests from Opndrive’s web address (Opndrive CORS docs).
  • Opndrive adds no password, no per-person access, no early revoke, and no saved link list (Opndrive source, checked 2026-11-27).

In this guide

By default, every object (S3’s word for a file) in Amazon S3 is private (AWS S3 sharing docs). A presigned URL signs time-limited access to one file with your key, without changing your bucket policy (AWS S3 presigned URLs).

An access key is the ID and secret pair proving a request comes from your account. Signing a link with Signature Version 4 (the S3 signing method) combines your secret key with the HTTP method (the web request type, such as GET to read a file), the file path, the expiry time, and the Host header (the storage server’s domain name) (AWS signed-request docs).

Amazon S3 and Cloudflare R2 (2026-11-12) call presigned URLs bearer tokens: anyone holding the link gets in without logging in. Anyone with the URL can fetch the file with a standard browser download (HTTP GET) (AWS presign command reference). It works many times until expiry, with no single-use mode (AWS Prescriptive Guidance). AWS states, “The logs identify the signer, not who later uses the URL” (AWS S3 presigned URLs).

Opndrive in your browser signs a presigned URL; recipient sends HTTP GET; storage provider checks signature and expiry
Opndrive signs the link in your browser, and your storage provider checks the signature, key, and expiry before returning or denying the file.

What you need before you share

Have four things ready before you create a link:

  • A bucket (your provider’s top-level container) holding the file.
  • An access key ID and secret key that can list the bucket and read the file (s3:ListBucket and s3:GetObject on AWS). To limit blast radius if a key leaks, use a key limited to one bucket in our minimum IAM policy guide (IAM, Identity and Access Management, is the permission system that controls what each key can access).
  • Opndrive open at https://opndrive.app/connect or your self-hosted address.
  • A CORS rule so your browser lets Opndrive call your storage endpoint (your provider’s web address) (MDN CORS guide, Opndrive CORS docs).

Open Opndrive and connect your bucket

On /connect, pick Amazon S3, Cloudflare R2, Wasabi, Backblaze B2, DigitalOcean Spaces, MinIO, or Custom endpoint (Opndrive’s guide to connecting storage). Enter your access key, secret key, bucket, and region (plus an endpoint if your provider requires one, and an optional prefix or connection name), then click Connect to your S3 storage. Opndrive checks the key by listing one object.

Opndrive saves your keys in localStorage (browser storage kept between page loads). Requests go straight from your browser to your provider, never to an Opndrive server (Opndrive FAQ). Anyone using your unlocked browser can read localStorage, so click Clear Session on shared computers.

To self-host your own copy, follow Opndrive’s deployment guide.

Add a CORS rule to the bucket

Browsers block scripts from calling another domain unless the server sends CORS (Cross-Origin Resource Sharing) headers (MDN CORS guide). A bucket CORS rule permits Opndrive’s origin, HTTP methods, and headers, and exposes ETag (Opndrive CORS docs). Set AllowedOrigins to your Opndrive address; * lets any website call your bucket.

JSON
[
  {
    "AllowedOrigins": ["https://opndrive.app"],
    "AllowedMethods": ["GET", "PUT", "POST", "DELETE", "HEAD"],
    "AllowedHeaders": ["*"],
    "ExposeHeaders": ["ETag"],
    "MaxAgeSeconds": 3000
  }
]

If you self-host, replace https://opndrive.app with your own address (such as http://localhost:3000). In Amazon S3, the console requires JSON (AWS CORS examples):

  1. In the left navigation pane, choose General purpose buckets.
  2. Choose your bucket.
  3. Choose Permissions.
  4. In Cross-origin resource sharing (CORS), choose Edit.
  5. Paste the JSON rule into the CORS configuration editor.
  6. Choose Save changes.

For other providers, read our CORS guide for S3, R2, MinIO, B2 and Wasabi.

To share an S3 file with a link in Opndrive, open the file’s More actions menu, choose Share, and set an expiry up to 7 days:

  1. Double-click folders in My Drive to reach your file.
  2. Click the file’s More actions button. The menu shows Open with, Download, Share, Rename, File information, and Delete forever (file-overflow-menu.tsx).

    Opndrive's More actions menu for a file, with Share highlighted next to Download
    Choose Share in a file’s More actions menu, not Download, to set a link expiry.

  3. Choose Share to open the Share file dialog.

  4. Under Link expires in, choose 15 minutes, 30 minutes, 1 hour, 6 hours, 1 day (default), 3 days, or 1 week (share-dialog.tsx). You can also enter a custom duration in minutes, hours, or days. Above 7 days, Generate Link is disabled and a red Maximum message appears.

    The Share file dialog showing Link expires in highlighted and the Generate Link button
    Pick the shortest expiry that works under Link expires in before clicking Generate Link.

  5. Click Generate Link. The dialog displays “Anyone with this link can access the file” and an “Expires on” time from your browser’s clock (share-dialog.tsx, share-context.tsx).

  6. Copy the link and paste it into your email or chat.

Closing Share file clears the link, and Opndrive keeps no share history (share-dialog.tsx). Generating again signs a separate link while older ones keep working. Use Share for others; Download creates a fixed 15-minute (900-second) link for your browser (download-service.ts).

Opndrive signs share links with ResponseContentDisposition set to inline, opening images and PDFs in the browser tab (s3-api/src/index.ts). Signing runs locally against your storage endpoint (Opndrive FAQ), giving a provider URL like https://<ENDPOINT>/<BUCKET>/<KEY>?.... We did not inspect a live demo URL.

Share several files at once

Selecting multiple files and choosing Share generates links right away with no duration prompt (multi-share-dialog.tsx). They use the Settings bulk-share duration, which defaults to 7 days (use-settings.ts, settings/constants.ts). Shorten that setting first to avoid the longest exposure.

Test your link in a private window (no saved logins or cookies). Paste it in, and the file opens without a login prompt.

To test expiry, create a 1-minute custom link, wait 2 minutes, and open it in a private window. Once the signature expires, the provider denies the request (AWS Prescriptive Guidance). We did not capture a live expired-link error message (the server’s HTTP status code or XML text response) for this post.

Amazon S3 checks expiry when the HTTP request arrives, so active downloads finish even if expiry passes (AWS S3 presigned URLs). Restarting a dropped download after expiry fails, so give large files extra time. Opndrive computes “Expires on” from your browser’s clock; storage enforces the signed timestamp (share-context.tsx).

A Signature Version 4 presigned URL lasts up to 7 days (604,800 seconds) on Amazon S3, Cloudflare R2, and MinIO. Opndrive’s share dialog caps links at 7 days for every provider (Opndrive’s share-link update, share-dialog.tsx). Its signing wrapper checks only for negative durations (s3-api/src/index.ts).

Provider Longest link Official source
Amazon S3 7 days (604,800 s) via a CLI (command-line tool) or SDK (developer code library); 12 hours in the S3 console AWS S3 sharing docs, AWS S3 presigned URLs, AWS CLI reference
Cloudflare R2 1 second to 7 days (604,800 s) Cloudflare R2 docs (2026-11-12)
MinIO 7 days (604,800 s) in minio-go; mc share download defaults to 7 days minio-go, MinIO AIStor docs
Backblaze B2 Presigned URLs supported; docs state no maximum Backblaze B2 S3-compatible API docs (2025-12-10)

Links signed with temporary credentials (short-lived keys from an IAM role or session) stop at their own expiry or their credentials’ expiry, whichever comes first (AWS S3 presigned URLs).

Standard Opndrive connections use a long-term access key ID and secret with no session token (s3-api/src/core/types.ts). Session cutoffs apply only to CLI or SDK tools using temporary keys. Any link stops if its signing key is deactivated, revoked, or deleted (AWS S3 presigned URLs).

Cloudflare R2 custom domains and local hostnames

On Cloudflare R2, presigned URLs work only on the S3 API domain (<ACCOUNT_ID>.r2.cloudflarestorage.com), not a custom domain (your own web address) (Cloudflare R2 docs, 2026-11-12). Because Signature Version 4 signs the Host header, editing it breaks the link (AWS IAM signed requests). Opndrive signs against R2’s S3 API host, so share it unchanged (providers.ts).

The same rule applies to self-hosted MinIO. Opndrive signs with your connected endpoint (s3-api/src/index.ts), so a link using localhost or an internal Docker hostname fails outside your network. See how to sign links for an address the recipient can reach.

There is no per-link revoke button; you stop a link early by invalidating its signing credentials (AWS Prescriptive Guidance). Deactivating a permanent access key cancels every link it signed and breaks every connection using it (AWS Prescriptive Guidance, AWS S3 presigned URLs).

To narrow that blast radius, create a second access key with list and read permissions on the bucket and save it as a separate Opndrive connection. Make external links only there. Deactivating that key cuts off leaked links while your main connection keeps working.

What Opndrive does not do when you share

Sharing in Opndrive produces an expiring presigned URL and nothing else (legal-pages-ssr.test.tsx, Opndrive’s share-link update). You get no password protection, no user accounts or per-person access, no early revoke, and no saved link list (share-dialog.tsx).

The app also lacks folder sharing and zip downloads, so you share files one by one or select several to generate separate links.

When this doesn’t fit

Direct presigned URLs fit occasional transfers. Switch patterns when you need stricter controls, custom domains, or a protected server.

For passwords, per-user permissions, download counts, or per-link revoke, use a backend API proxy. Because S3 presigned URLs grant access without checking identity (AWS S3 presigned URLs), a backend checks accounts and keeps keys off browsers, trading off server bandwidth and memory.

For custom domains, caching, or edge filtering, put a CDN (content delivery network) in front of the bucket. On Cloudflare R2, Cloudflare points to WAF HMAC validation (Pro plan or above) for authenticated custom domains (Cloudflare R2 docs, 2026-11-12), adding edge setup and CDN billing.

For TLS termination, upload limits, or timeouts in front of self-hosted storage like MinIO, add a reverse proxy (a server handling HTTPS and forwarding requests). Under Signature Version 4, it must pass the Host header unchanged (AWS IAM signed requests), adding server maintenance.

Without Opndrive, the Amazon S3 console makes links up to 12 hours without code (AWS S3 sharing docs). With the AWS CLI installed and configured with your credentials, aws s3 presign reaches 7 days (604,800 seconds) (AWS CLI presign reference). Pass --endpoint-url and --region for R2, B2, or MinIO. On Amazon S3, omit --endpoint-url or pass https://s3.<REGION>.amazonaws.com for newer regions.

Try Opndrive

Opndrive gives any S3-compatible bucket a Drive-like web interface you host yourself.
See it on GitHub or read the docs.

Curious about Opndrive?

Take a look at our FAQ to learn more.

Opndrive

Ready to take control of your S3 storage?

Connect your S3 bucket in minutes and start managing your files with Opndrive's beautiful, modern interface.

Build Opndrive with us

Live demos, reviews on your PRs, and a hand when you get stuck.

Be an early member
Join our Discord