Scenario-Based Fastly Interview Questions (2027)

36 scenario-based Fastly interview questions: shielding side effects, loop detected 503s, soft purge, request collapsing, stale-if-error, timeouts.

Oct 1, 2025 - 10:21
Nov 9, 2026 - 09:33
 0  75
Scenario-Based Fastly Interview Questions (2027)

Scenario-based Fastly interview questions describe a CDN incident or design problem, such as a cache hit ratio that looks wrong after enabling shielding, a 503 "Loop detected", soft purges that do not behave as expected or stale content that will not serve during an outage, and ask how you would find the cause and fix it. Interviewers want reasoning tied to how Fastly's cache, VCL lifecycle and purge system actually work.

This page has 36 scenarios with answers, checked against Fastly's developer documentation in November 2026. It is part of a set: the Fastly interview preparation guide is the main page with a six-week plan, the Fastly questions for freshers cover basics and the Fastly FAQs give short answers. The scenarios below avoid the common "old CSS after deploy" and "purge-all spike" stories already answered on those pages and go one level deeper.

Key takeaways

  • Know the VCL order: vcl_recv, vcl_hash, then vcl_hit, vcl_miss or vcl_pass, then vcl_fetch, vcl_error if triggered, vcl_deliver and finally vcl_log.
  • With shielding, edge code usually runs twice (edge POP and shield POP), so separate origin-facing logic from client-facing logic.
  • Soft purge (header Fastly-Soft-Purge: 1) works for URL and surrogate key purges, never for purge all.
  • Stale-while-revalidate takes precedence over stale-if-error; if the SWR window is greater than or equal to the SIE window, SIE never applies.
  • Before purging in response to unexplained errors, find the cause. Fastly's error guide warns that purging usually raises origin traffic.

Where to look first

SymptomFirst thing to checkTypical cause
503 with "Loop detected"Backend hostnameBackend points back at the Fastly domain
Synthetic 503 after a waitfirst_byte_timeout and origin latencySlow origin endpoint
CHR dropped after enabling shieldingHow shield hits are countedEdge miss plus shield hit counts as two events
Origin flooded by one URLRequest collapsing eligibilityPass or hit-for-pass on a popular object
Wrong content for some usersCache key and response changes at the shieldCache poisoning or missing Vary
Stale not served during outageSWR and SIE valuesSWR window covers SIE

Freshers: first scenarios (1-10)

1. A new Fastly service returns 503 "Loop detected" on every request. What happened?

The backend is the same hostname as the public domain, so Fastly sends the request back to itself. Fastly's error guide says loops are rejected after 3 prior POP visits, 6 unique services or 20 total hops. Point the backend at a separate origin hostname (for example origin.example.com) or an IP address.

2. You need to know whether a response came from cache. What do you check?

Look at the X-Cache response header. Fastly reports HIT for cache hits (including stale and synthetic responses) and MISS for everything else; a PASS is reported as MISS. With shielding you may see two values, one per POP.

curl -sI https://www.example.com/logo.png | grep -i x-cache

3. You want to see TTL and path details while debugging a single request. How?

Send Fastly-Debug: 1. Fastly then adds Fastly-Debug-Path, Fastly-Debug-TTL and Fastly-Debug-Digest, and keeps Surrogate-Key and Surrogate-Control on the response instead of stripping them.

curl -sI -H "Fastly-Debug: 1" https://www.example.com/products/42

4. A product page changed. How do you remove only pages that show that product?

Tag responses with a Surrogate-Key header (for example product-42 category-shoes) and purge by key through the API: POST /service/{service_id}/purge/product-42. Every page carrying that key is invalidated without touching the rest of the cache.

5. Marketing wants new prices live fast, but the origin is fragile. Hard or soft purge?

Soft purge. It marks objects stale instead of removing them, so the next request can get the stale copy while Fastly fetches the new one. Send the purge with Fastly-Soft-Purge: 1.

curl -X POST -H "Fastly-Key: $FASTLY_API_TOKEN" -H "Fastly-Soft-Purge: 1" \
  https://api.fastly.com/service/$SERVICE_ID/purge/price-list

6. Someone asks for a soft purge-all. Can you do it?

No. Purge all is always a hard purge. Fastly's purging API docs suggest applying a constant surrogate key such as all to every object, then soft purging that key, which gives the same effect.

7. You need to purge 200 different surrogate keys after a catalogue import. How do you do it efficiently?

Use the batch endpoint POST /service/{service_id}/purge, which accepts up to 256 keys in one request. URL and surrogate key purges are limited separately from other API calls, to an average of 100,000 per hour per customer.

8. Some surrogate keys on large pages never purge. Why?

The header has limits: 1,024 bytes per key and 16,384 bytes for the whole header. If a limit is hit, that key and every key after it in the header are ignored. Shorten keys, drop low-value keys, or tag at a coarser level.

9. Which subroutine would you edit to change the cache key?

vcl_hash, which computes the cache key. Every return state from vcl_recv except restart passes through it. Keep the key minimal; adding headers to it can split the cache and lower the hit ratio.

10. An API endpoint must never be cached. Where do you make that decision?

In vcl_recv with return(pass) for that path, or in vcl_fetch if the decision depends on the origin response. Passing in vcl_recv avoids a cache lookup entirely.

2-5 years: caching and shielding scenarios (11-24)

11. After enabling shielding, the dashboard shows a lower cache hit ratio, but origin traffic fell. Is something wrong?

Probably not. Fastly's shielding guide explains that an edge miss that hits at the shield counts as two events, and a request that reaches origin counts as two misses, so the reported ratio can look lower. Judge the change by origin request volume and origin offload, not the raw CHR number.

12. After enabling shielding, responses have duplicated headers. What happened?

Edge code typically runs twice, once at the edge POP and once at the shield. Logic that adds a header in vcl_deliver runs in both places. Use fastly.ff.visits_this_service to apply client-facing changes only where its value is 0 (the POP connected to the client).

13. Some users get a page with another user's CORS header after shielding was added. Why?

The response was changed at the shield and then stored in edge caches, which is the cache poisoning risk Fastly's shielding guide warns about. Make client-specific changes at the client-facing POP only, and keep shield-side changes generic.

14. The shield returns 500 errors after you rewrote the Host header at the edge. What is the fix?

Changing Host at the edge can make the shield reject the request. Set the origin host with override_host on the backend instead, or change Host only at the shield.

15. Rate limiting by client IP stopped working once shielding was enabled. Why?

At the shield, the client is the edge POP, not the user. Read the real address from the Fastly-Client-IP header for rate limiting, logging and geolocation logic that runs at the shield.

16. A popular page expired and the origin got thousands of identical requests at once. Request collapsing should have prevented that. What do you check?

Whether those requests were eligible. Request collapsing does not apply to requests passed in vcl_recv, to requests that find a hit-for-pass marker, or when req.hash_ignore_busy is true. Check for a return(pass) rule matching the page, a Set-Cookie or private response creating hit-for-pass, or a debugging snippet that set hash_ignore_busy.

17. One URL keeps bypassing the cache for about two minutes after the origin sent a private response. Why?

A cacheable pass response (for example one marked private, or passed in vcl_fetch) creates a hit-for-pass marker. By default it lasts 2 minutes, or the response TTL if that is between 2 minutes and 1 hour. Requests that hit it go straight to origin. Fix the origin headers so shared responses are not marked private.

18. The origin was down for 20 minutes, but users still got errors although stale-if-error=86400 was set. Why?

Check the stale-while-revalidate value. Both windows start when max-age expires, SWR takes precedence, and if the SWR window is greater than or equal to the SIE window, SIE never applies. Also check that stale objects still exist (they can be evicted) and that the shield is not set to zero stale with req.max_stale_if_error.

Cache-Control: max-age=300, stale-while-revalidate=60, stale-if-error=86400

19. The origin sends Cache-Control: private for browsers, but you want Fastly to cache for one hour. How?

Send Surrogate-Control: max-age=3600 from the origin. Fastly gives it priority over Cache-Control and removes it before the response reaches the client, so browsers still see the private header. Fastly's docs say to use max-age rather than s-maxage in Surrogate-Control.

20. A report endpoint returns a synthetic 503 after about a minute, while the origin finishes in 90 seconds. What do you change?

The backend's first_byte_timeout is shorter than the endpoint needs, so Fastly aborts and returns a synthetic 503. Raise it only for that path at runtime with bereq.first_byte_timeout in VCL, rather than for the whole backend, and ask the team to make the report asynchronous long term.

21. Large file downloads end early but return 200. What is happening?

Check between_bytes_timeout. For Delivery services, if the origin pauses longer than this between chunks, Fastly treats the response received so far as complete. Raise the timeout for that backend or fix the origin stall.

22. Connections to a new origin fail with 503 only from some POPs. Where do you look?

The connection stage. connect_timeout controls how long Fastly waits to establish the connection; if it runs out, Fastly returns a synthetic 503. Check origin firewalls and allow lists for Fastly's IP ranges, network paths from those regions and whether the timeout is too tight for distant POPs.

23. During an incident, a colleague wants to purge everything "to be safe". What do you say?

Not until the cause is known. Fastly's error guide warns that purging in response to unexplained errors usually raises origin traffic and can make things worse. Identify whether the errors come from the origin, from your VCL or Compute code, or from Fastly itself first.

24. You chain two Fastly services and debug headers leak to the second service and origin. How do you stop that?

The Fastly-Debug request header is passed to origins by default. Fastly recommends unsetting http.bereq.Fastly-Debug in vcl_miss and vcl_pass when using service chaining, and stripping the header in vcl_recv unless it matches a value only your team knows.

Senior: design scenarios (25-30)

25. Design cache invalidation for an e-commerce site with 2 million product pages.

Tag each response with keys for product, category and brand, plus a constant key for a soft global purge. Use soft purges for content updates and batch purges (up to 256 keys) from the catalogue pipeline. Keep long TTLs with stale-while-revalidate so purges do not cause origin bursts.

26. How do you plan shielding for an origin in Mumbai serving users worldwide?

Choose a shield POP close to the origin so most cache misses are filled from there. Split client-facing and origin-facing logic for double execution, use Fastly-Client-IP for client logic, and remember that inter-POP traffic counts toward requests and bandwidth. A service that passes most requests may cost more with shielding.

27. When would you not use shielding?

For services that pass nearly every request, because shielding can almost double request count and bandwidth with no cache benefit. Fastly also notes you cannot apply shielding to backends defined in VCL, and that Compute services implement shielding in code and should fail open to origin if the shield is unavailable.

28. How do you roll out a risky VCL change?

Clone the active version, make the change, validate it, test against a staging domain or with a header-gated condition, then activate. If errors rise, reactivate the previous version, which is quick because Fastly keeps earlier versions. Keep VCL in Git and deploy through Terraform or the Fastly CLI.

29. How do you design a logging pipeline that helps with these scenarios?

Stream logs from vcl_log to your log platform with POP, cache state, status, backend, timing and the client IP. With that you can split errors by POP, see hit or miss per URL and spot timeouts by backend.

30. What would you monitor for a Fastly service?

Origin offload and request volume, error rates split by origin errors and synthetic 503s, latency per POP, purge counts, and changes to service versions. Alert on sudden drops in offload or spikes in synthetic 503s.

Multi-step incidents (31-36)

31. Errors spike in one region only. Walk through your steps.

Filter logs by POP to confirm the region, check whether responses are synthetic 503s (connect or first-byte timeouts) or origin errors, test the origin from that region, and check recent version changes. If one origin region is unhealthy, route those requests to a healthy backend with health checks and conditions.

32. A deploy changed the cache key and the hit ratio fell from 92% to 40%. How do you prove it and fix it?

Compare Fastly-Debug-Digest values for the same URL across requests: different digests show the key now varies. Find the header or query parameter added in vcl_hash or a new Vary value, remove it or normalise it in vcl_recv, and roll back the version if the fix takes time.

33. The origin team says "Fastly is down", but you see 503s with a valid origin body. Who owns it?

A valid response from the origin is not a Fastly error, even if the status is 503. Show them the response body and backend logs. Fastly-generated errors are synthetic, often with an empty body or a Fastly error message.

34. A Compute service returns blank 500s in production. How do you debug it?

Fastly's error guide says a blank 500 means the program ended before sending a response, and unhandled errors go to stderr. Use log tailing to capture that output, reproduce locally with the same inputs, and add error handling that returns a meaningful response.

35. Soft purges seem to have no effect: users still get old content for minutes. Why?

That is how soft purge works with stale serving. The object is marked stale, and if stale-while-revalidate allows it, the next request gets the stale copy while Fastly fetches the new one in the background. If content must change immediately (for example a legal takedown), use a hard purge.

36. After moving to a new origin, login stops working for some users through Fastly. What do you check?

Whether login responses are cached or collapsed. Make sure login and session paths are passed in vcl_recv, that Set-Cookie responses are not cached, that the cache key does not ignore needed cookies, and that the new origin receives the expected Host header (use override_host).

Related pages

See the Fastly certification interview questions for exam-style practice and the scenario-based Cloudflare questions if you are comparing CDNs. CDN work sits inside wider DevOps practice, which our DevOps training covers in Kharadi, Pune and live online.

FAQ

What are scenario-based Fastly interview questions?

Questions that describe a CDN incident or design task, such as a cache hit ratio drop or a 503 error, and ask how you would find the cause and fix it.

Why does my cache hit ratio look lower after enabling shielding?

Fastly counts an edge miss that hits at the shield as two events, so the reported ratio can drop even while origin traffic falls.

Can Fastly purge all be a soft purge?

No. Purge all is always hard. Tag every object with a constant surrogate key and soft purge that key instead.

How do I request a soft purge?

Add the Fastly-Soft-Purge: 1 header to a URL or surrogate key purge request.

What causes a 503 "Loop detected" from Fastly?

The request looped back to Fastly, usually because the backend uses the same hostname as the public domain.

Why is stale-if-error not working?

If the stale-while-revalidate window is greater than or equal to the stale-if-error window, SIE never takes effect. Stale objects may also have been evicted.

How do I find the real client IP behind a shield?

Read the Fastly-Client-IP header, because the shield sees the edge POP's address.

References

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.