Signed URLs and Token-Based Access
What you'll learn: How to secure private media files with time-limited, cryptographically verified access tokens.
When hosting private images and videos, you can't simply hand out permanent public URLs — anyone who gets the link could share it indefinitely. Signed URLs solve this by embedding cryptographic proof that the request is authorized and valid only for a limited time.
How Signed URLs Work
Think of a signed URL like a VIP ticket with an expiration timestamp and a tamper-proof hologram. The server generates a URL containing:
- The resource path (e.g.,
/private/video123.mp4) - An expiration timestamp (e.g., valid until 3:00 PM)
- A cryptographic signature — a hash of the URL + timestamp using a secret key only the server knows
When a CDN or storage service receives the request, it:
- Checks if the current time is before the expiration
- Recalculates the signature using its secret key
- Compares signatures — if they match, the URL is authentic and unmodified
If someone tries to extend the expiration or change the path, the signature won't match, and access is denied.
Token-Based Access Pattern
Instead of encoding everything in the URL, some systems use access tokens passed as headers or query parameters. The flow:
- User requests access → application validates permissions
- Server generates a signed token (like JWT) containing user ID, resource ID, expiration
- Client presents token when fetching media
- CDN/origin validates token signature and expiration before serving content
This works well with your Origin Shield Pattern — the shield validates tokens before hitting origin storage, preventing unauthorized access from reaching deeper layers.
Key Takeaway: Signed URLs and tokens use cryptographic signatures with expiration timestamps to create temporary, tamper-proof access credentials for private media, preventing unauthorized sharing while leveraging CDN distribution.