Skip to content
Prompt Words
History Member

Signed URL

Also called: pre-signed URL, presigned URL.

A link to one private file that carries its own permission: an expiry time and a signature made with your app's credentials. Your app checks the user and signs the link; the browser then downloads straight from storage, which checks the signature and the time. Anyone who has the link can use it until it expires, so keep the expiry short and never log it.

Download the report, then use the same link after 5 minutes (the wait is shortened here), or change one character in it. A signed URL works for anyone who has it until it expires, so keep the expiry short and don't log it.

Downloads: 0 · Refused: 0 · Bytes through the app: 0

Ana wants the Q3 report. It sits in a private bucket: no public link can reach it.

    No link yet

    Say it in a prompt

    Serve report PDFs from the private S3 bucket reports with presigned URLs. In GET /reports/:id, check that the signed-in user may read that report, then redirect the browser to a presigned GET URL for the object that expires in 5 minutes (ExpiresIn=300). Keep Block Public Access on, never stream the file through the app, and don't write the URLs to logs. Sign with credentials that outlive the link: a presigned URL also stops working when the signing role's session ends, even if a longer expiry was asked.

    Vague vs precise prompt

    Vague prompt

    let users download their reports

    Typical resultMakes the bucket public so the links work, or streams every file through the app server. A public link works for anyone, forever, once it leaks, and links leak easily: through server logs, the Referer header, browser history or a link pasted in a chat. Streaming ties up the app with every large download.

    Precise prompt

    Keep the reports bucket private. In GET /reports/:id check that the user may read it, then redirect to a presigned S3 URL that expires in 5 minutes. Don't log the URLs.

    Typical resultThe app only checks the user and signs; the browser downloads the file straight from S3. A link that leaks stops working after 5 minutes, and a link with one character changed is refused with 403.

    Seen on

    • Amazon S3 docs: A presigned URL gives time-limited access to one object without changing the bucket policy. It can be used many times until it expires, and S3 checks the expiry when each request arrives. The docs call presigned URLs bearer tokens and say to protect them.
    • Google Cloud Storage docs: Anyone who has a signed URL can use it while it is active, even without a Google account. The longest expiry is 7 days, so send the URL securely and pick the expiry you need.
    • Amazon CloudFront docs: Your application checks that the user may see the file, then creates and returns a signed URL. CloudFront rejects a URL whose signature doesn't match because it was changed, then checks the expiry time.

    You might describe it as

    • a download link that stops working after a few minutes
    • let the browser fetch the file straight from the bucket
    • send a private file as a link that runs out

    Not to be confused with

    • CDN

      A CDN keeps copies of files near users so they load fast; a signed URL is a short-lived permission to fetch one private file, from storage or through a CDN.