Design an Image Proxy Cache for Remote Images in Gmail
Last updated: November 29, 2026
Quick Overview
Design the service that fetches external images embedded in emails on behalf of Gmail users, caches them, and serves them from Google's domain so senders cannot see users' IP addresses and malicious images are filtered.
0
0
0 solved
Design the service that fetches external images embedded in emails on behalf of Gmail users, caches them, and serves them from Google's domain so senders cannot see users' IP addresses and malicious images are filtered.
Gmail proxies remote images for privacy and safety, which makes a caching design with a security angle. The interviewer checks cache keying, handling of tracking pixels, abuse resistance (the proxy must not become an open fetcher), and behavior with origins that are slow or hostile.
What the Interviewer Expects
- Rewrite image URLs at render time to signed proxy URLs
- Cache fetched images keyed by origin URL with sensible TTL
- Prevent the proxy from being used for SSRF or as an open relay
- Transcode or sanitize images to strip harmful content
- Handle hostile or slow origins with timeouts and size limits
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How does caching affect senders who use per-recipient tracking pixels?
- How do you stop the proxy from fetching internal Google addresses?
- What would you do when one marketing email goes to 50 million inboxes at once?
- How do you respect origin cache headers that say no-store?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
- When a message renders, external
<img src>URLs are replaced with proxy URLs. - The proxy fetches from the origin, validates and re-encodes the image, caches it, and serves it.
- Users' IPs and co...
High-Level Design
- Rewriter (in the Gmail render path): produces
https://proxy/<hmac>/<encoded-url>, signed with a secret so only Gmail-generated URLs work. - Proxy frontends: verify signature, look up cache...