All jobs / Full-stack developer / System Design Basics
Full-stack developer interview question · 3–5 years
Invoices and uploaded documents are streamed from object storage by the API, and that endpoint is now the slowest thing we run.
How do you put a CDN in front of private files without leaking them?
The strongest answer
Authorise in the API, then hand the browser a short-lived signed URL for that one object; the bucket stays private, the link expires in minutes, and the edge never caches a response keyed by user
Why it works
Right — the API keeps the decision, the edge moves the bytes, and the signature carries a permission the URL cannot outlive.
What a good answer covers
- Decide in the API; serve at the edge.
- Short-lived signed URL per object.
- The bucket stays private.
- Never cache per-user bytes by URL.
Answers that fall short
- Close, but not the strongest: Issue signed URLs, but make them long-lived so the browser can cache the document for the whole session
The mechanism is right and the lifetime is the control: a link that lives for a day can be forwarded, logged and reused. - Weak: Make the bucket public and use long random file names that nobody could guess
An unguessable URL is still a public URL; it leaks through referrers, chat previews, bookmarks and screenshots, and it never expires. - Red flag: Put the CDN in front of the API and cache the authorised responses, so the next request is instant
Caching an authorised response by URL serves one customer’s invoice to the next request — a data breach, not a performance bug.
Who gets asked this
More System Design Basics questions
- The recommendations API is 500ing. Checkout and search are fine. What do you ship for a partial outage?
- Someone enabled the CDN in front of the API and `/api/me` started looking very fast. How do you cache a page…
- The API has run on a single server for a year, and you are adding a second behind a load balancer. What in…