Cloudflare Engineer Interview Questions with Answers (2027)

100 Cloudflare engineer interview questions with answers: DNS, caching, SSL/TLS modes, WAF, DDoS, Workers, Zero Trust, Tunnel, R2 and Terraform.

Sep 30, 2025 - 11:12
Nov 6, 2026 - 09:40
 0  595
Cloudflare Engineer Interview Questions with Answers (2027)

Cloudflare engineer interviews test how well you understand the traffic path from a visitor, through Cloudflare's global network, to your origin: DNS, caching, SSL/TLS modes, the WAF, DDoS protection, Workers, Zero Trust (Access and Tunnel), load balancing, R2 and automation with Terraform. This page has 100 questions with short answers, grouped by level and followed by troubleshooting scenarios.

Product names, limits and settings were checked against the Cloudflare developer documentation in November 2026.

Key takeaways

  • Freshers are asked how a proxied (orange cloud) record works, how DNS setup differs between full and partial setups, and what the SSL/TLS encryption modes do.
  • The most common practical questions are about errors 521, 522, 524, 525 and 526, redirect loops, cache hit ratio and WAF false positives.
  • Page Rules are deprecated. Answers should use Cache Rules, Configuration Rules, Redirect Rules and Origin Rules.
  • Workers questions focus on the isolate model, CPU time limits and choosing between KV, D1, Durable Objects, R2 and Queues.
  • Zero Trust questions focus on Access policy actions and their evaluation order, service tokens, and Cloudflare Tunnel with cloudflared.
  • Version 5 of the Cloudflare Terraform provider renamed many resources, for example cloudflare_record to cloudflare_dns_record.

How to use this guide

Each answer starts with the reply you can give in the interview, followed by the detail an interviewer may ask next. For general DevOps rounds around these topics, see our 200+ DevOps interview questions guide. If networking basics feel rusty, read the OSI model explained before the DDoS section.

Your experienceRead firstThen practise
Fresher or support engineerQuestions 1 to 20Add a domain to a free plan, proxy a record and test SSL/TLS modes
2 to 5 yearsQuestions 21 to 63Cache Rules, a WAF custom rule, a rate limiting rule and a Worker with an R2 binding
Senior, solutions or security engineerQuestions 64 to 79Access with an identity provider, a Tunnel, a load balancer and Terraform for all of it
EveryoneQuestions 80 to 100 (scenarios and design)Explain each scenario aloud in under two minutes

Cloudflare interview questions for freshers

1. What does Cloudflare do?

Cloudflare runs a global network that sits between visitors and your servers. For proxied traffic it acts as a reverse proxy, which lets it provide authoritative DNS, a CDN, SSL/TLS termination, a web application firewall, DDoS protection, bot management and load balancing. It also offers a developer platform (Workers, R2, KV, D1, Durable Objects, Queues) and a Zero Trust platform, Cloudflare One (Access, Gateway, Tunnel and the WARP client).

2. What is a reverse proxy, and why does Cloudflare need to be one?

A reverse proxy receives requests on behalf of an origin server and forwards them. Because visitors connect to Cloudflare instead of the origin, Cloudflare can cache responses, inspect requests with the WAF, absorb attacks and terminate TLS before anything reaches your server. It also hides the origin IP, as long as the origin is not exposed some other way.

3. What is anycast, and how does Cloudflare use it?

With anycast, the same IP addresses are announced through BGP from many data centres. Internet routing sends each visitor to a nearby location. Cloudflare uses anycast for its DNS and proxy addresses, which lowers latency and spreads attack traffic across the whole network instead of one site.

4. What is the difference between a proxied record and a DNS-only record?

A proxied record (orange cloud) returns Cloudflare anycast IPs, so HTTP and HTTPS traffic flows through Cloudflare and gets caching, the WAF and DDoS protection. A DNS-only record (grey cloud) returns your origin IP directly, so Cloudflare only answers the DNS query. Mail servers and other non-HTTP services are usually DNS-only, unless you use Spectrum for TCP or UDP proxying.

5. What is the difference between a full setup and a partial (CNAME) setup?

In a full setup you change the domain's nameservers at the registrar to the two Cloudflare nameservers assigned to the zone, and Cloudflare becomes the authoritative DNS. In a partial setup, available on Business and Enterprise plans, another provider stays authoritative, and you point individual hostnames to Cloudflare with CNAME records. Partial setups suit companies that cannot move DNS.

6. Which DNS record types do you work with most?

A and AAAA for IPv4 and IPv6 addresses, CNAME for aliases, MX for mail, TXT for verification, SPF, DKIM and DMARC, CAA to restrict which certificate authorities can issue for the domain, SRV for services, and NS for delegating subdomains. Cloudflare also supports record types such as HTTPS, SVCB and DS.

7. What is CNAME flattening?

The DNS standard does not allow a CNAME at the zone apex (for example, example.com) alongside the SOA and NS records. With CNAME flattening, Cloudflare follows the CNAME chain itself and answers with the final A or AAAA records. This lets you point the root domain at a hostname such as a load balancer or a SaaS endpoint.

8. What TTL does a proxied record have?

Proxied records use an Auto TTL of 300 seconds, and you cannot change it, because Cloudflare controls the anycast IPs behind them. You can set TTLs on DNS-only records. When planning a migration, lower TTLs on DNS-only records a day or two before the change so old answers expire quickly.

9. What is DNSSEC, and how do you enable it on Cloudflare?

DNSSEC signs DNS records so that resolvers can detect forged answers. Enable DNSSEC in the zone's DNS settings, then add the DS record that Cloudflare shows at your registrar. Some registrars add it automatically. If you move DNS providers, remove or update the DS record first, otherwise validating resolvers will fail to resolve the domain.

10. What is the difference between Cloudflare's authoritative DNS and 1.1.1.1?

Authoritative DNS answers queries for zones you host on Cloudflare. 1.1.1.1 is a public recursive resolver that anyone can use to look up any domain, with support for DNS over HTTPS and DNS over TLS. They are separate services; interviewers sometimes mix them up on purpose.

11. What does Cloudflare cache by default?

By default Cloudflare caches responses for static file extensions such as images, CSS, JavaScript and fonts, and it respects the origin's Cache-Control headers. It does not cache HTML or JSON by default. To cache more, or less, you create Cache Rules, for example "cache everything" on a path with an edge TTL.

12. What does the cf-cache-status header tell you?

It shows what the cache did with a response. HIT means it was served from cache, MISS means it was fetched from the origin, EXPIRED means a stale copy was refreshed, BYPASS means a rule or header told Cloudflare not to cache, and DYNAMIC means the resource was not eligible for caching. Other values include STALE, REVALIDATED and UPDATING.

curl -sI https://www.example.com/assets/app.css | grep -i -E "cf-cache-status|cache-control|age"

13. What are the SSL/TLS encryption modes?

ModeVisitor to CloudflareCloudflare to origin
OffHTTP onlyHTTP only
FlexibleHTTPSHTTP, unencrypted
FullHTTPSMatches the visitor's protocol; HTTPS without validating the origin certificate
Full (strict)HTTPSLike Full, and the origin certificate must be valid (public CA or Cloudflare Origin CA)
Strict (SSL-Only Origin Pull)HTTP or HTTPSAlways HTTPS with a validated certificate, whatever the visitor used

By default zones use Automatic SSL/TLS, which scans the origin and moves the zone to the most secure mode it supports. It never downgrades the setting.

14. What is Universal SSL?

Universal SSL is the free edge certificate Cloudflare issues for a zone on every plan. It covers the apex and first-level subdomains (example.com and *.example.com). Deeper subdomains such as api.eu.example.com need an advanced certificate (Advanced Certificate Manager) or a custom certificate.

15. What is a Cloudflare Origin CA certificate?

It is a free certificate you install on your origin server. It is trusted by Cloudflare, not by browsers, so it only works for traffic that goes through Cloudflare's proxy, and it is valid for use with Full (strict). You can choose a long validity, up to 15 years, which removes most origin renewals.

16. What does the WAF do?

The Web Application Firewall inspects HTTP requests at the edge and takes an action when a rule matches. It has custom rules that you write with the Rules language, managed rulesets that Cloudflare maintains (the Cloudflare Managed Ruleset and the Cloudflare OWASP Core Ruleset), rate limiting rules, and protections for leaked credentials and malicious uploads, depending on plan.

17. How does Cloudflare protect against DDoS attacks?

DDoS protection is always on and is included on every plan without a usage cap. Autonomous systems at each data centre detect and drop attack traffic at layers 3, 4 and 7. You can tune the HTTP DDoS attack protection and network-layer managed rulesets, for example changing sensitivity or the action for a rule. Anycast spreads large attacks across the network.

18. What are Cloudflare Workers?

Workers is a serverless platform that runs JavaScript, TypeScript, Python or WebAssembly on Cloudflare's network, close to users. Workers run in V8 isolates rather than containers, so they start very quickly. Common uses are API backends, request and response rewriting, authentication at the edge, A/B testing and full-stack apps with Workers static assets.

19. What is Zero Trust in Cloudflare's products?

Zero Trust means no user or device is trusted just because it is on a network; each request is checked against identity, device posture and policy. Cloudflare One provides it through Access (identity-aware access to applications), Gateway (DNS, network and HTTP filtering for users), the WARP client on devices and Cloudflare Tunnel to connect private networks without opening inbound ports. Our post on zero trust in DevSecOps explains the wider idea.

20. How do you restore the real visitor IP at the origin?

For proxied traffic the origin sees Cloudflare IP addresses as the client. Cloudflare sends the visitor's IP in the CF-Connecting-IP header and also appends it to X-Forwarded-For. Configure the web server to trust these headers only from Cloudflare's published IP ranges, for example with mod_remoteip in Apache or the real_ip module in NGINX.

CDN, caching and performance (2 to 5 years experience)

21. What are Cache Rules, and what replaced Page Rules?

Page Rules are deprecated. Their settings moved to purpose-built rule types: Cache Rules for caching, Configuration Rules for zone settings per path, Redirect Rules (single and bulk) for redirects, Origin Rules to change the origin host, port or DNS record, and Transform Rules for rewriting URLs and headers. Cache Rules match requests with the Rules language and can set eligibility for cache, edge TTL, browser TTL, cache key options and more.

22. What is the difference between edge TTL and browser TTL?

Edge TTL is how long Cloudflare keeps an object in its cache before revalidating with the origin. Browser TTL is how long the visitor's browser keeps it, set through the Cache-Control header Cloudflare sends. A common pattern is a long edge TTL with purge on deploy, and a short browser TTL, because you cannot purge browser caches.

23. What is a cache key, and why does it affect hit ratio?

The cache key decides which requests share a cached object. By default it includes the scheme, host, path and query string. If URLs carry tracking parameters or random values, every request has a different key and misses the cache. In a Cache Rule you can ignore or sort query strings, or include a header, cookie or device type when the response really differs.

24. What is Tiered Cache?

With Tiered Cache, lower-tier data centres ask an upper-tier data centre before going to the origin, so the origin gets far fewer requests. Smart Tiered Cache, which picks the best upper tier for each origin automatically, is available on all plans. Generic Global, Regional and Custom topologies are Enterprise features.

25. How do you purge the cache, and what methods exist?

You can purge by single URL (the recommended method), by cache tag, by hostname, by URL prefix, or purge everything. All five methods are available on every plan, with rate limits that grow with the plan. A purge from CI after a deploy usually looks like this:

curl -X POST "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/purge_cache" \
  -H "Authorization: Bearer $CF_API_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"files":["https://www.example.com/index.html","https://www.example.com/assets/app.css"]}'

A 200 response only means Cloudflare accepted the request. Confirm with a request that cf-cache-status is no longer HIT.

26. How do cache tags help large sites?

The origin adds a Cache-Tag response header with labels such as product-123 or category-shoes. When a product changes, you purge the tag and every page carrying it is removed, without listing each URL. This keeps purges small and avoids "purge everything", which sends a burst of traffic to the origin.

27. How do you cache HTML safely for a site with logged-in users?

Create a Cache Rule that makes HTML eligible for cache only when the request has no session cookie, and bypass cache when the cookie is present. Make sure the origin never returns personalised content without that cookie, and that it does not send Set-Cookie on cacheable responses. Test with curl with and without the cookie and compare cf-cache-status.

28. What is Argo Smart Routing?

Argo Smart Routing is a paid add-on that sends uncached requests over the fastest paths in Cloudflare's network, using real-time latency and congestion data, instead of the default internet route to the origin. It helps dynamic, uncacheable traffic most. Combine it with Tiered Cache so that cache misses also travel efficiently.

29. Which protocols does Cloudflare support between the visitor and the edge?

HTTP/1.1, HTTP/2 and HTTP/3 over QUIC, with TLS 1.3 by default and settings for the minimum TLS version. Connections to the origin are configured separately; HTTP/2 to the origin can be turned on. For non-HTTP TCP and UDP applications, Spectrum proxies the traffic.

30. How do you reduce load on the origin during a traffic spike?

Raise cache eligibility and edge TTLs for content that can be cached, use Tiered Cache, serve stale content while revalidating, move simple logic into a Worker, and add rate limiting rules on expensive endpoints such as search or login. On the origin side, make sure only Cloudflare IPs can reach it so attackers cannot bypass the cache.

SSL/TLS questions (2 to 5 years experience)

31. Why is Flexible mode risky?

Traffic between Cloudflare and the origin is plain HTTP, so it can be read or changed on the way, while the visitor's browser shows a padlock. It also causes redirect loops when the origin redirects HTTP to HTTPS. Use Full (strict) with a public certificate or an Origin CA certificate instead.

32. What do Always Use HTTPS and HSTS do?

Always Use HTTPS redirects every HTTP request to HTTPS at the edge. HSTS sends the Strict-Transport-Security header, which tells browsers to use only HTTPS for the domain for a set time. Turn on HSTS only after HTTPS works everywhere, including subdomains if you include them, because browsers will refuse HTTP until the max-age expires.

33. What is Authenticated Origin Pulls?

It is mutual TLS between Cloudflare and your origin. Cloudflare presents a client certificate when it connects, and the origin is configured to accept only connections that present it. This proves a request came through Cloudflare. You can use Cloudflare's shared certificate or upload your own per zone or per hostname for stronger isolation.

34. How do you set the minimum TLS version?

In SSL/TLS edge certificate settings, choose the Minimum TLS Version (for example TLS 1.2). Clients that only support older versions will fail to connect. Check analytics for traffic on older TLS versions before raising it, especially for APIs used by old devices or embedded systems.

35. What is the difference between Universal, Advanced and Custom certificates?

Universal certificates are free, automatic and cover the apex and one level of wildcard. Advanced certificates (Advanced Certificate Manager) let you choose hostnames, including deeper subdomains, the certificate authority and validity. Custom certificates are ones you upload yourself, often required by enterprise security policies. Cloudflare for SaaS issues certificates for your customers' own domains.

36. What is Cloudflare for SaaS?

It lets a SaaS provider put customers' own domains (for example shop.customer.com) on the provider's Cloudflare zone as custom hostnames. Cloudflare issues and renews certificates for those hostnames and applies the provider's WAF, caching and Workers to them. The customer only adds a CNAME to the provider's fallback origin hostname.

37. Why might a certificate fail to issue for a new hostname?

Common reasons are a CAA record that does not allow the certificate authority Cloudflare is using, DNS for the hostname not pointing at Cloudflare yet (for HTTP validation), a TXT validation record that was not added, or a hostname deeper than the Universal certificate covers. The certificate status in the dashboard or API shows which validation step is pending.

WAF, bots and rate limiting (2 to 5 years experience)

38. How do you write a WAF custom rule?

A custom rule has an expression in the Rules language and an action. For example, this expression blocks requests to an admin path unless they come from the office IP range:

(http.request.uri.path wildcard r"/admin/*" and not ip.src in {203.0.113.0/24})

Rules are evaluated in order, and the first terminating action ends evaluation. Test new rules with the Log action (Enterprise) or start with a challenge rather than a block.

39. Which actions can a WAF custom rule take?

Block, Managed Challenge, JS Challenge, Interactive Challenge, Skip and Log. Managed Challenge is usually the best challenge choice because Cloudflare picks the least intrusive check for each visitor. Skip lets matching requests bypass other rules or products, which is how you create exceptions.

40. What are the Cloudflare Managed Ruleset and the OWASP Core Ruleset?

The Cloudflare Managed Ruleset is written by Cloudflare's security team and covers known vulnerabilities and fast-moving threats, including new CVEs. The Cloudflare OWASP Core Ruleset is Cloudflare's version of the OWASP ModSecurity Core Rule Set. It works by anomaly score: each matching rule adds to a score, and the action fires when the score passes a threshold you set. A paranoia level from PL1 to PL4 controls how many rules are active; higher levels catch more but cause more false positives.

41. A managed rule blocks a legitimate request. How do you fix it without turning the rule off?

Find the request in Security Events, note the rule ID and the field that matched. Then add an exception (a skip rule) that skips that one rule only for the affected path or hostname, or adjust the OWASP anomaly score threshold if many low-scoring rules add up. Avoid disabling the whole ruleset or skipping all rules for the site.

42. How do rate limiting rules work?

A rate limiting rule has a matching expression, characteristics that decide what is counted (for example IP address, a header, a cookie, an API key or a JWT claim on higher plans), a number of requests per period, an action (Block, Managed Challenge, JS Challenge, Interactive Challenge or Log) and a duration. The block response defaults to HTTP 429. With a counting expression you can count only some requests, for example failed logins with response status 401.

43. How would you rate limit a login endpoint?

Match http.request.uri.path eq "/login" and the POST method, count by IP (or by IP with NAT support), and use a counting expression that counts only responses with status 401 or 403. Choose a threshold such as a handful of failures per minute and a Managed Challenge rather than a hard block, so shared networks are not locked out. Watch Security Events to tune it.

44. What is the difference between Bot Fight Mode, Super Bot Fight Mode and Bot Management?

Bot Fight Mode on the Free plan challenges requests that match known bot patterns, with little control. Super Bot Fight Mode on Pro and Business adds choices per bot category (definitely automated, likely automated, verified bots). Bot Management for Enterprise gives each request a bot score from 1 to 99 that you can use in WAF rules, plus detection IDs and JA3 and JA4 fingerprints.

45. What is Turnstile?

Turnstile is Cloudflare's CAPTCHA alternative for forms. You add a widget to a page, the browser gets a token without a puzzle in most cases, and your server validates the token with the Siteverify API before accepting the form. It works on sites that do not use Cloudflare's proxy.

46. What are verified bots, and why should you not block them?

Verified bots are known good crawlers and services, such as search engine crawlers, that Cloudflare identifies and verifies. Blocking them can drop your pages from search results or break monitoring. In WAF rules you can refer to them with the cf.client.bot field, or the verified bot category fields in newer rules.

47. How do you protect APIs on Cloudflare?

Use API Shield features where available: schema validation against an OpenAPI file, mutual TLS for client authentication, JWT validation and sequence mitigation. Add rate limiting rules counted by API key or token, WAF managed rules, and Access service tokens for machine-to-machine APIs that should not be public at all.

DDoS and origin protection

48. What are the HTTP DDoS and network-layer DDoS managed rulesets?

The HTTP DDoS attack protection managed ruleset covers layer 7 floods for proxied HTTP traffic. The network-layer DDoS managed ruleset covers layer 3 and 4 attacks such as SYN and UDP floods. Both are on by default. You can override sensitivity and action per rule, for example lower the sensitivity for an API that legitimately gets bursts of traffic.

49. What are Spectrum and Magic Transit?

Spectrum is a reverse proxy for TCP and UDP applications, such as SSH, game servers or custom protocols, so they get DDoS protection and hide the origin IP. Magic Transit protects entire IP networks: Cloudflare advertises your IP prefixes with BGP, scrubs traffic at the edge and delivers clean traffic to your data centres through tunnels. Spectrum works per application; Magic Transit works per network.

50. Attackers are hitting the origin IP directly. What do you do?

The origin IP has leaked, often through old DNS records, a mail server on the same IP or historical DNS data. Change the origin IP if possible, then lock the origin down: allow inbound traffic only from Cloudflare's published IP ranges, or better, remove public inbound access entirely and connect with Cloudflare Tunnel. Add Authenticated Origin Pulls so only Cloudflare can complete a TLS connection.

51. What is "Under Attack" mode?

It is a security setting that shows a challenge to every visitor before they reach the site, which stops many layer 7 floods but also affects real users and APIs. Use it for a short time during an attack, or better, scope a challenge to the attacked path with a custom rule so the rest of the site works normally.

52. How do you watch an attack as it happens?

Use Security Analytics and Security Events in the dashboard to see top source IPs, ASNs, countries, paths and user agents, and which rules acted. The GraphQL Analytics API and Logpush to a SIEM or R2 give the same data for automation and long-term storage. Notifications can alert you when Cloudflare mitigates a DDoS attack.

Workers and the developer platform (2 to 5 years experience)

53. How do Workers differ from AWS Lambda or containers?

Workers run in V8 isolates, many of which share one process, so a new isolate starts in milliseconds and there is no container to boot. Code runs in Cloudflare locations close to the user by default. The trade-off is a restricted runtime: Workers follow web standard APIs (fetch, Request, Response, Web Crypto) with optional Node.js compatibility, and have CPU and memory limits per request.

54. How do you create and deploy a Worker?

npm create cloudflare@latest my-worker
cd my-worker
npx wrangler dev
npx wrangler deploy
npx wrangler tail

wrangler dev runs the Worker locally, wrangler deploy publishes it and wrangler tail streams live logs. In CI, authenticate with an API token in the CLOUDFLARE_API_TOKEN environment variable.

55. What does a Wrangler configuration file look like?

Wrangler accepts wrangler.jsonc, wrangler.json or wrangler.toml; Cloudflare recommends wrangler.jsonc for new projects. A minimal file with KV and R2 bindings:

{
  "name": "orders-edge",
  "main": "src/index.ts",
  "compatibility_date": "2026-11-01",
  "observability": { "enabled": true },
  "kv_namespaces": [
    { "binding": "CONFIG", "id": "<KV_NAMESPACE_ID>" }
  ],
  "r2_buckets": [
    { "binding": "UPLOADS", "bucket_name": "orders-uploads" }
  ]
}

Bindings appear on the env object in your code, for example env.UPLOADS.put(key, body). The compatibility_date pins runtime behaviour so updates do not change your Worker unexpectedly.

56. What are the main Workers limits?

LimitWorkers FreeWorkers Paid
CPU time per HTTP request10 ms30 seconds by default, configurable up to 5 minutes
Memory per isolate128 MB128 MB
Subrequests per request5010,000 by default

CPU time excludes time spent waiting on network I/O, so a Worker that mostly waits on fetch calls uses little CPU. There is no duration limit for HTTP requests while the client stays connected.

57. When do you use KV, D1, Durable Objects, R2 or Queues?

ProductWhat it isGood for
Workers KVGlobal key-value store, eventually consistentConfiguration, feature flags, cached lookups read far more than written
D1Serverless SQL database built on SQLiteRelational data for Workers apps
Durable ObjectsSingle-instance objects with strongly consistent storageCounters, rate limiters, chat rooms, coordination, WebSockets
R2S3-compatible object storage with no egress feesFiles, images, backups, logs, static assets
QueuesMessage queue with producer and consumer WorkersBackground jobs, batching, decoupling slow work

58. Why might a value written to KV not be visible right away?

KV is eventually consistent. A write is visible at once in the location that made it, but other locations may serve a cached older value until it expires, which can take 60 seconds or more. If you need read-after-write consistency, use Durable Objects or D1 instead.

59. What are Durable Objects?

A Durable Object is a class you define; each object instance has a unique ID, runs in one location at a time and processes requests one at a time, with its own transactional storage. Because there is exactly one instance per ID, it can hold state that many clients share, such as a counter, a document being edited or a WebSocket room, without race conditions.

60. Why would a team choose R2 over another object store?

R2 has no egress fees, so serving the same files many times does not add data transfer charges. It is S3-compatible, so existing S3 SDKs and tools work by changing the endpoint and credentials. Pricing is based on storage and on Class A (writes and lists) and Class B (reads) operations, and there is an Infrequent Access storage class with a retrieval fee and 30-day minimum.

61. How do you run a Worker on a schedule?

Add Cron Triggers in the Wrangler configuration and export a scheduled handler. On the Paid plan, a cron run can use up to 30 seconds of CPU when the interval is under an hour, and up to 15 minutes when it is an hour or more. Use Queues or Workflows for longer multi-step jobs.

62. What is the difference between a Workers route and a custom domain?

A route attaches a Worker to a URL pattern on a proxied zone, such as example.com/api/*, and runs in front of the origin. A custom domain makes the Worker the origin for a whole hostname: Cloudflare creates the DNS record and certificate, and there is no other origin behind it.

63. How do you debug a Worker in production?

Enable Workers Logs with observability in the configuration, then search logs in the dashboard. Use wrangler tail for a live stream, filtered by status or by text. Log structured JSON with a request ID, and check the Worker's metrics for errors, CPU time and subrequests. Exceptions show the stack trace in logs.

Zero Trust, Access and Tunnel (senior)

64. How does Cloudflare Access protect an internal application?

You add the app as a self-hosted application in Access, connect an identity provider (for example Microsoft Entra ID, Okta, Google Workspace or GitHub, or a one-time PIN), and write policies. Users reach the app's public hostname, Cloudflare redirects them to log in, checks the policy and then forwards the request with a signed JWT in the Cf-Access-Jwt-Assertion header. The origin should validate that JWT.

65. What are the Access policy actions, and in what order are they evaluated?

The actions are Allow, Block, Bypass and Service Auth. Service Auth and Bypass policies are evaluated first, top to bottom, then Allow and Block policies, top to bottom, and evaluation stops at the first matching Allow or Block. Access denies by default, so Block is mostly used for exceptions. Bypass turns off enforcement and logging for matching traffic and is not recommended for internal apps.

66. What do Include, Require and Exclude mean in a policy?

Include works like OR: a user must match at least one Include rule, and every policy needs one. Require works like AND: the user must match every Require rule. Exclude works like NOT: matching any Exclude rule removes the user. For example, include the example.com email domain, require the Engineering group and a managed device, and exclude contractors.

67. How do machines or CI jobs authenticate to an Access-protected app?

Create a service token, which has a client ID and client secret, and add a Service Auth policy that allows that token. The calling system sends the values in the CF-Access-Client-Id and CF-Access-Client-Secret headers. Rotate tokens on a schedule and give each consumer its own token so you can revoke one without affecting others. Mutual TLS is another Service Auth option.

68. What is Cloudflare Tunnel, and why use it?

Cloudflare Tunnel connects a server or network to Cloudflare through a lightweight daemon, cloudflared, that makes outbound-only connections. You do not open inbound firewall ports or expose a public origin IP, so attackers cannot reach the origin directly. Public hostnames on the tunnel can be protected with Access, and private network routes let WARP users reach internal IPs.

69. How do you create a locally managed tunnel?

cloudflared tunnel login
cloudflared tunnel create app-tunnel
cloudflared tunnel route dns app-tunnel app.example.com
cloudflared tunnel run app-tunnel

The configuration file maps hostnames to local services and must end with a catch-all rule:

tunnel: 6ff42ae2-765d-4adf-8112-31c55c1551ef
credentials-file: /etc/cloudflared/6ff42ae2-765d-4adf-8112-31c55c1551ef.json
ingress:
  - hostname: app.example.com
    service: http://localhost:8080
  - hostname: ssh.example.com
    service: ssh://localhost:22
  - service: http_status:404

Check the rules with cloudflared tunnel ingress validate. Remotely managed tunnels, created in the dashboard or API and run with a token, keep the configuration in Cloudflare instead, which is easier to manage at scale.

70. How do you make a tunnel highly available?

Run more than one cloudflared replica for the same tunnel on different hosts; each replica opens its own connections to Cloudflare, and traffic continues if one host fails. Run cloudflared as a system service or a Kubernetes Deployment, keep it updated, and monitor tunnel health in the dashboard or through notifications.

71. What do Gateway and the WARP client do?

The WARP client runs on user devices and sends their traffic to Cloudflare. Gateway then applies DNS, network and HTTP policies, for example blocking malware domains, preventing uploads to unapproved file-sharing sites or allowing access to private IP ranges only for certain groups. Device posture checks such as disk encryption or OS version can feed into both Gateway and Access policies.

Load balancing and automation (senior)

72. How does Cloudflare Load Balancing work?

A load balancer is attached to a hostname and sends traffic to pools. Each pool contains endpoints (origin servers), and monitors run health checks against them from Cloudflare locations. Unhealthy endpoints and pools are taken out of rotation. A load balancer can be proxied, which gives instant failover and works with the WAF and caching, or DNS-only, which returns IPs and depends on DNS TTLs for failover.

73. What traffic steering policies can a load balancer use?

  • Standard: Off (failover by pool order, for active-passive) or Random (weighted split across pools).
  • Geo: send visitors from regions or countries to specific pools.
  • Dynamic: pick the pool with the lowest measured round-trip time.
  • Proximity: pick the closest pool based on coordinates you set.
  • Least Outstanding Requests: pick the pool with the fewest pending requests.

74. What is session affinity, and when do you need it?

Session affinity keeps a visitor on the same endpoint for the session, usually with a cookie that Cloudflare sets. You need it when the application stores session state on one server. It reduces the evenness of load and can hold users on a server that is slowly failing, so a better long-term fix is to store sessions in a shared store.

75. A primary pool recovered, but traffic did not move back. Why?

With Off (failover) steering, traffic normally returns to the primary pool when it is healthy again. Session affinity can keep existing visitors on the standby pool, and DNS-only load balancers depend on resolvers refreshing their cached answers. Check the pool health history, the monitor results and the affinity settings.

76. How do you manage Cloudflare with Terraform?

Use the official cloudflare/cloudflare provider with a scoped API token. Version 5 of the provider renamed more than 40 resource types, for example cloudflare_record became cloudflare_dns_record, and changed some attributes, such as value to content for DNS records. Cloudflare publishes a migration guide and a tf-migrate tool. A v5 DNS record looks like this:

resource "cloudflare_dns_record" "www" {
  zone_id = var.zone_id
  name    = "www"
  type    = "A"
  content = "203.0.113.10"
  ttl     = 1
  proxied = true
}

ttl = 1 means automatic, which proxied records use. For more Terraform depth, see our Terraform interview questions.

77. How do you bring existing Cloudflare settings under Terraform?

Use cf-terraforming to generate Terraform configuration and import commands from an existing account or zone, then review and commit the output. Run terraform plan until it shows no changes, and only then let the pipeline apply. After that, make changes only through code, or the next apply will undo dashboard edits.

78. What is the difference between an API token and the Global API Key?

An API token is scoped: you choose permissions (for example Zone DNS Edit), the zones or accounts it applies to, optional IP restrictions and an expiry. The Global API Key has full access to everything the user can do and cannot be scoped. Use API tokens for automation, one per tool, and store them in a secrets manager.

79. How are WAF and other rules represented in the API and Terraform?

Most rule products are built on the Rulesets engine. Each zone or account has entry point rulesets for phases such as http_request_firewall_custom (WAF custom rules), http_ratelimit (rate limiting), http_request_cache_settings (Cache Rules) and http_request_dynamic_redirect (Redirect Rules). In Terraform you manage them with the cloudflare_ruleset resource, one per phase, which also makes rule order explicit in code.

Scenario-based and troubleshooting questions

For more practice in this format, see our scenario-based Cloudflare interview questions and the longer Cloudflare interview questions for DevOps security.

80. Users see Error 521. What is happening?

521 means the origin web server refused the connection from Cloudflare. Usually the web server is down, or a firewall or security tool on the origin is blocking Cloudflare's IP ranges (for example, after it saw many requests from a few Cloudflare IPs). Check that the service is running, that the firewall allows Cloudflare's IP ranges on ports 80 and 443, and that the DNS record points to the right IP.

81. Users see Error 522. How do you troubleshoot it?

522 means Cloudflare could not complete a TCP connection to the origin in time, or the origin did not respond after the connection. Common causes are an overloaded origin, a firewall silently dropping Cloudflare packets, the wrong origin IP in DNS, or the origin not listening on the expected port. Test from outside with curl using --resolve to send the request straight to the origin IP.

curl -v --resolve www.example.com:443:198.51.100.20 https://www.example.com/health

82. A report endpoint returns Error 524. What does that mean?

524 means Cloudflare connected to the origin, but the origin did not send an HTTP response before the Proxy Read Timeout, which is 120 seconds by default (Enterprise plans can raise it). Long-running requests such as large exports should be made asynchronous: start a job, return at once, and let the client poll or receive a callback. Enterprise customers can raise the timeout with a Cache Rule or the zone setting, up to 6,000 seconds.

83. After switching to Full (strict), users see Error 526 or 525. Why?

526 means the origin certificate is not valid for Full (strict): it is expired, self-signed, issued for a different hostname or missing the chain. 525 means the TLS handshake itself failed, for example the origin does not listen on 443, has no certificate configured, or does not support the needed TLS settings or SNI. Install a valid public certificate or a Cloudflare Origin CA certificate for the hostname, then retest.

84. The site is stuck in a redirect loop (ERR_TOO_MANY_REDIRECTS). What is the usual cause?

The SSL/TLS mode is Flexible while the origin redirects HTTP to HTTPS. Cloudflare connects to the origin over HTTP, the origin redirects to HTTPS, the browser asks Cloudflare for HTTPS, and Cloudflare again connects over HTTP. Fix it by installing a certificate on the origin and using Full (strict). Conflicting Redirect Rules or an application redirect based on the wrong header can cause the same symptom.

85. Cache hit ratio is low after a launch. How do you improve it?

Check cf-cache-status and the Cache analytics to see why requests miss: DYNAMIC means not eligible, BYPASS often means the origin sends Set-Cookie or Cache-Control: private. Then make static assets cacheable with long TTLs and versioned file names, normalise the cache key by ignoring tracking query strings, cache HTML for anonymous users where safe, and turn on Tiered Cache.

86. A DNS change was made in Cloudflare, but some users still reach the old server. Why?

Recursive resolvers and operating systems cache the previous answer until its TTL expires. If the record was DNS-only with a long TTL, some users keep the old IP for that long. Check what different resolvers return with dig. If nameservers were changed recently, the registrar's NS records and the TLD's cache also take time to update.

dig +short app.example.com @1.1.1.1
dig +short app.example.com @8.8.8.8
dig NS example.com +trace

87. A WAF rule deployed this morning is blocking checkout. What do you do?

First restore service: disable or change the action of the new rule, or add a narrow skip rule for the checkout path. Then find the matching events in Security Events to see which field matched, fix the expression, and test it with the Log action or a challenge before blocking again. Afterwards, add a review step for WAF changes, ideally through Terraform pull requests, so a rule can be reverted from Git.

88. A Worker fails with "Exceeded CPU time limit". How do you fix it?

Measure where CPU goes: heavy JSON parsing, crypto, image or HTML processing, or large loops. On the Paid plan you can raise the CPU limit in the configuration, up to five minutes. Better fixes are caching computed results in KV or the Cache API, streaming responses instead of buffering, moving heavy work to Queues, and keeping global-scope initialisation small because startup has its own limit.

89. A Worker cannot read from its R2 bucket. What do you check?

Check that the binding name in the configuration matches the name used in code (env.UPLOADS), that the bucket name is correct and exists in the same account, and that the Worker was redeployed after adding the binding. In local development, wrangler dev uses a local simulation by default, so data in the real bucket is not visible unless you run with remote bindings. Log the object key, because a wrong key returns null rather than an error.

90. Users get Error 1033 on a hostname that uses Cloudflare Tunnel. What is wrong?

Error 1033 means Cloudflare cannot find a healthy tunnel connection for the hostname. The cloudflared process may be stopped, unable to reach Cloudflare through an outbound firewall, or running a different tunnel than the DNS record points to. Check cloudflared tunnel info and the tunnel status in the dashboard, restart the service and confirm the CNAME targets the right tunnel ID.

91. After a new Access policy, some employees are blocked. How do you find out why?

Look up the user's attempt in the Access authentication logs, which show which policy matched or why none did. Common causes are a Require rule the user does not meet (wrong group claim or device posture), an Exclude rule that matches more users than intended, or policy order placing a Block before the Allow. Fix the policy, then test with the policy tester before telling users to retry.

92. How do you handle a large layer 7 DDoS attack on a login page?

Confirm in Security Analytics that the HTTP DDoS managed rules are acting. If attack traffic still gets through, add a rate limiting rule on the login path, a custom rule that challenges traffic matching the attack's pattern (user agent, ASN, country, JA4 fingerprint), and raise the DDoS ruleset sensitivity for that rule if needed. Confirm the origin is reachable only through Cloudflare. After the attack, keep the rules that helped and remove emergency settings such as Under Attack mode.

93. An origin certificate is about to expire. How do you avoid an outage?

Renew and install the new certificate on the origin before expiry, or replace it with a Cloudflare Origin CA certificate with a long validity, or use an ACME client that renews automatically. Monitor origin certificate expiry separately from the edge certificate, because Cloudflare renews edge certificates for you but not the one on your server.

94. The load balancer keeps marking a healthy endpoint as unhealthy. What do you check?

Compare the monitor settings with what the endpoint really serves: path, expected status codes, expected body text, host header, port and protocol. Check that the endpoint's firewall allows the health checks from Cloudflare, and that the timeout and retries suit the endpoint's response time. Look at the health check results per region, since a network issue in one region can fail some checks but not others.

95. How would you migrate a production domain to Cloudflare with no downtime?

  1. Add the zone and review the imported DNS records against the current provider, including MX, TXT and CAA.
  2. Start with records as DNS-only, then switch web records to proxied after testing.
  3. Make sure an edge certificate is active and the origin has a valid certificate for Full (strict).
  4. Lower TTLs at the old provider in advance, and disable DNSSEC there or plan the DS change.
  5. Change nameservers at the registrar, then watch analytics, origin logs and error rates.

Coding and system design questions

96. How does consistent hashing help a CDN or load balancer?

Consistent hashing places servers and keys on a ring, and each key goes to the next server on the ring. When a server is added or removed, only the keys near it move, instead of almost all keys as with hash(key) mod N. CDNs use it to decide which cache server owns an object, which keeps hit ratios high when the fleet changes. Virtual nodes spread load more evenly.

97. Explain a token bucket rate limiter.

Each client has a bucket with a maximum number of tokens. Tokens are added at a fixed rate, and each request takes one token; if the bucket is empty, the request is rejected or delayed. It allows short bursts up to the bucket size while enforcing an average rate. You only need to store the token count and the last refill time per client, and compute refills lazily on each request.

98. How would you build an LRU cache, and what is its complexity?

Combine a hash map from key to node with a doubly linked list ordered by recent use. A get looks up the node in the map and moves it to the front; a put inserts at the front and, when the cache is full, removes the node at the back and deletes its key from the map. Both operations run in O(1) time, and memory is O(n) for n entries.

99. Design a global per-user rate limiter on Cloudflare's developer platform.

Route each user to a Durable Object keyed by user ID, so all of that user's requests are counted in one place with strongly consistent storage. The Durable Object keeps a token bucket or sliding window and returns allow or deny to the Worker in front of the API. Discuss the trade-off: one object per user adds a hop to wherever that object runs, so for simple IP-based limits a WAF rate limiting rule at the edge is cheaper and faster.

100. Design a globally distributed website that stays up if one origin region fails.

Put the site behind Cloudflare with Full (strict) TLS and Authenticated Origin Pulls. Serve static assets from cache with Tiered Cache, and use a load balancer with pools in two or more regions, monitors per pool and Dynamic or Geo steering. Connect origins through Cloudflare Tunnel so they have no public inbound ports. Add WAF managed rules, rate limiting on sensitive paths and Access for admin tools. Manage all of it with Terraform, and test failover by disabling a pool.

How to prepare for a Cloudflare interview

  • Put a test domain on the Free plan. Proxy a record, try each SSL/TLS mode, write a Cache Rule and a WAF custom rule, and read the response headers with curl.
  • Build a small Worker with an R2 or KV binding and deploy it with Wrangler from a CI pipeline.
  • Protect a private app with Access through a Cloudflare Tunnel, and write the policy in Terraform.
  • Practise the 5xx error scenarios aloud, because they come up in almost every support and SRE interview.

DevOps Training Institute teaches the related skills in classroom batches in Kharadi, Pune and in live online classes across India. The DevSecOps course covers web application security, WAF concepts and zero trust, and the Terraform course covers the infrastructure as code skills used to manage Cloudflare at scale.

FAQs

What is the difference between Full and Full (strict) SSL in Cloudflare?

Both encrypt traffic between Cloudflare and the origin. Full does not check the origin certificate, so a self-signed or expired certificate still works. Full (strict) requires a valid certificate for the hostname, from a public CA or the Cloudflare Origin CA. Use Full (strict) in production.

Are Cloudflare Page Rules still used?

Page Rules are deprecated. Use Cache Rules for caching, Configuration Rules for per-path settings, Redirect Rules for redirects, Origin Rules to change the origin and Transform Rules for URL and header changes. Interviewers may ask you how you would migrate an old Page Rule.

What causes Cloudflare Error 522?

Cloudflare could not establish or complete a TCP connection to the origin in time. The usual causes are an overloaded or offline origin, a firewall that drops Cloudflare's IP ranges, a wrong origin IP in DNS, or the server not listening on the expected port.

What is the Workers CPU time limit?

On the Free plan a Worker gets 10 ms of CPU time per HTTP request. On the Paid plan the default is 30 seconds and it can be raised to five minutes. Time spent waiting on network requests does not count as CPU time.

Does Cloudflare Tunnel need open inbound ports?

No. The cloudflared daemon makes outbound connections to Cloudflare, so the origin needs no inbound firewall rules and no public IP. Run at least two replicas for availability and protect public hostnames with Access.

Does R2 charge for egress?

No. R2 does not charge egress fees for data read through the Workers API, the S3 API or r2.dev domains. You pay for storage and for Class A and Class B operations, and the Infrequent Access class adds a retrieval fee.

Which Terraform resource manages DNS records in provider version 5?

cloudflare_dns_record. In version 4 it was cloudflare_record. The record value moved from the value attribute to content, and Cloudflare's migration guide and tf-migrate tool help move existing state.

What should I learn first for a Cloudflare engineer role?

Learn DNS, HTTP and TLS well, because most questions build on them. Then learn caching and Cache Rules, the WAF and rate limiting, the SSL/TLS modes and the 5xx errors. Add Workers and Zero Trust next, and manage everything with Terraform.

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.