ByteDance Frontend Interview: HTTP Caching & Status Codes
Question Description
This question evaluates your practical understanding of HTTP caching and status codes—two pillars of web performance and client-server behavior.
You will be asked to explain how caching headers (Cache-Control, ETag, Last-Modified) work in the browser and CDN layers, the difference between validation and invalidation, and when to use public vs private caches. Be ready to discuss common Cache-Control directives (max-age, no-cache, no-store, must-revalidate), conditional requests (If-None-Match, If-Modified-Since), and how ETag differs from Last-Modified in accuracy and overhead.
Expect the interview flow to start with conceptual questions (what each header does), move to applied scenarios (design cache headers for static assets vs API responses, handle cache busting for JS bundles), and finish with debugging tasks (using curl and browser DevTools to reproduce stale content or 304 responses). You may also be asked how redirects (301 vs 302) affect caching and SEO, and how status codes like 404, 410, 403, and 500 should be handled by clients and CDNs.
Skill signals the interviewer looks for: clear command of HTTP header semantics, hands-on debugging experience (DevTools/curl), understanding of CDN caching behavior and TTLs, and awareness of SEO/user-experience implications. Use examples and command-line snippets when explaining your approach.
Common Follow-up Questions
- •How would you design Cache-Control headers for a single-page app that serves versioned JS bundles and frequently updated API data?
- •Compare ETag and Last-Modified: how do they affect conditional requests, and when might one be preferred over the other?
- •How do CDNs handle stale content and revalidation (stale-while-revalidate, stale-if-error), and how would you configure TTLs for mixed-content sites?
- •Walk me through how you would debug a user-reported stale asset using browser DevTools and curl; what exact requests and headers would you inspect?
Related Questions
Explore More Questions
Practice This Question with AI
Get real-time hints, detailed requirements, and insightful analysis of the question.