If clients upload large files (images, PDFs, videos) directly to a backend server, the server's CPU and bandwidth get choked, causing slowdowns for other users.
The Valet Key Pattern solves this:
1. The Client requests a temporary "signed upload URL" from the Server for a specific file.
2. The Server checks permissions, requests/generates a pre-signed URL (e.g. with AWS S3 credentials) and returns it to the client.
3. The Client uploads the file directly to Cloud Storage using that URL.
4. The backend server never has to handle the heavy file bytes!
In this scenario:
1. Request 1: Client asks Server for a signed URL.
2. Backtrack: Server returns the signed URL containing a secure token.
3. Request 2: Client bypasses the server and sends file bytes directly to Cloud Storage.
4. Backtrack: Cloud Storage records the upload success in the bucket and responds to the Client.
Interactive Checkpoints:
Add Custom Storage Bucket
LoadClick here to add 'secure-invoices' and 'user-profiles' to Cloud Storage, and update client request targets.
No frames available