Real-Time Cloudflare Interview Questions (2027)

40 real-time Cloudflare interview questions with commands: API tokens, DNS and purge API, Wrangler deploy and rollback, cloudflared, Terraform v5.

Sep 30, 2025 - 11:21
Nov 10, 2026 - 06:06
 0  73
Real-Time Cloudflare Interview Questions (2027)

Real-time Cloudflare interview questions test whether you can operate Cloudflare from a terminal: call the API with a scoped token, purge cache and prove it worked, deploy and roll back a Worker with Wrangler, run a Tunnel with cloudflared, and keep Terraform in sync. Good answers give the exact command, the check you run afterwards and the safety step you take first.

This page has 40 hands-on questions for DevOps and SRE roles. Commands and limits were checked against Cloudflare's developer documentation in November 2026. It is part of a set: the Cloudflare engineer interview questions page is the main bank of concepts, and the scenario-based Cloudflare questions page covers incident stories. This page is about the commands you would actually type.

Key takeaways

  • Use API tokens with the narrowest permission and zone scope, sent as Authorization: Bearer. Cloudflare recommends tokens over the Global API Key.
  • A purge API call that returns HTTP 200 means Cloudflare accepted it, not that every copy is gone. Check CF-Cache-Status afterwards.
  • Wrangler can upload a Worker version without deploying it, split traffic by percentage, tail live logs and roll back to an earlier version.
  • cloudflared ingress rules must end with a catch-all rule, and cloudflared tunnel ingress validate checks them before you restart.
  • In Terraform provider v5, cloudflare_record was renamed to cloudflare_dns_record; Cloudflare's migration tool is tf-migrate.

Tools and the tasks interviewers give you

ToolLive taskCheck afterwards
Cloudflare API (curl)Create a DNS record, purge cache, verify a tokendig, curl -sI, API response success
WranglerDeploy, gradual rollout, tail logs, rollback, secretswrangler deployments list, wrangler tail
cloudflaredCreate and run a Tunnel, route DNScloudflared tunnel ingress rule, systemctl status cloudflared
TerraformManage zones, records and rules as codeterraform plan shows no drift
Browser and curl headersDiagnose cache and origin errorsCF-Cache-Status, CF-Ray, 52x codes

Freshers: API and DNS basics (1-12)

1. How do you authenticate to the Cloudflare API?

With an API token in a Bearer header. Cloudflare's API docs call this the preferred scheme and recommend tokens over the legacy Global API Key with X-Auth-Email and X-Auth-Key, because a token can be limited to specific permissions and zones.

curl "https://api.cloudflare.com/client/v4/user/tokens/verify" \
  --header "Authorization: Bearer $CF_API_TOKEN"

A valid token returns "status": "active".

2. How do you scope a token for a CI job that only edits DNS for one domain?

Create a token with a Zone policy, permission DNS Edit, and a resource rule that includes only that zone. Cloudflare also lets you set an expiry and client IP address filtering, so you can tie the token to your CI runners' egress IPs.

3. Where do you find the zone ID?

On the zone's overview page in the dashboard, or from the API by listing zones filtered by name. Most zone-level endpoints need it in the path, for example /zones/{zone_id}/dns_records.

4. How do you create a proxied A record through the API?

curl -X POST "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records" \
  -H "Authorization: Bearer $CF_API_TOKEN" -H "Content-Type: application/json" \
  --data '{"type":"A","name":"app.example.com","content":"203.0.113.10","ttl":1,"proxied":true}'

A TTL of 1 means automatic. The API reference says other values must be between 60 and 86400 seconds (minimum 30 on Enterprise zones).

5. What does "proxied" mean, and how do you see it from outside?

A proxied (orange-cloud) record returns Cloudflare's anycast IPs, so traffic passes through Cloudflare's cache, WAF and other features. A DNS-only record returns your origin IP. Run dig +short app.example.com: Cloudflare IPs mean proxied.

6. Why can't you add an A record with the same name as an existing CNAME?

The API reference states that A and AAAA records cannot share a name with a CNAME record. Delete or rename the CNAME first. NS records also cannot share a name with any other type.

7. What is the CF-Ray header for?

It is a unique ID for each request that passes through Cloudflare. Quote it when you open a support ticket or search logs, because it ties a user's complaint to a specific request and data centre.

8. What do the CF-Cache-Status values mean?

HIT (served from cache), MISS (cache-eligible but not cached yet), EXPIRED (in cache but expired, refetched), STALE (expired copy served because the origin was unreachable), BYPASS (origin response not cacheable, for example no-store or Set-Cookie), REVALIDATED, UPDATING (stale copy served while refreshing), DYNAMIC (not cache-eligible, no lookup) and NONE/UNKNOWN.

curl -sI https://www.example.com/app.css | grep -i cf-cache-status

9. What do errors 521, 522 and 524 tell you?

521: the origin web server is down or refusing connections. 522: the TCP connection to the origin timed out. 524: Cloudflare connected but the origin took too long to send a response. 521 and 522 point to firewalls or a dead origin; 524 points to a slow application or report endpoint.

10. What do 525 and 526 tell you?

525 means the TLS handshake between Cloudflare and the origin failed. 526 means the origin certificate is invalid, which you see in Full (strict) mode when the certificate is expired, self-signed or does not match the hostname.

11. What is the difference between Full and Full (strict) SSL modes?

Cloudflare's SSL mode docs say Full connects to the origin over HTTPS without validating the certificate, while Full (strict) validates it. Use Full (strict) with a valid public certificate or a Cloudflare Origin CA certificate. Flexible sends origin traffic over plain HTTP, which is why it often causes redirect loops when the origin forces HTTPS.

12. How do you check whether a DNS change has reached resolvers?

Query Cloudflare's authoritative nameservers directly (dig @<ns>.ns.cloudflare.com app.example.com) to confirm the record exists, then query public resolvers to see whether the old cached answer has expired.

2-5 years: cache, Workers and Tunnels (13-30)

13. How do you purge one file through the API?

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/app.css"]}'

The token needs the Cache Purge permission. Other body fields are tags, hosts, prefixes and purge_everything, which must be the only field when used.

14. How do you prove a purge worked?

Cloudflare's docs say a 200 response confirms receipt, not eviction. Request the URL again and check that CF-Cache-Status is no longer HIT; the next request should be a MISS or EXPIRED, then HIT once it is cached again.

15. Which purge methods are available on which plans?

The purge documentation lists URL, hostname, tag, prefix and purge everything on all plans (Free, Pro, Business, Enterprise). Rate limits differ: for hostname, tag, prefix and purge-everything requests, Free allows 5 per minute while Enterprise allows 50 per second.

16. Why prefer tag purges over purge everything after a deploy?

Purge everything empties the zone cache and sends a burst of traffic to the origin. Tagging responses with a Cache-Tag header lets you purge only the release or product that changed, and the purge API accepts those tags in the tags field.

17. How do you deploy a Worker?

npx wrangler deploy builds and deploys the Worker defined in the Wrangler configuration file. Cloudflare recommends wrangler.jsonc for new projects; wrangler.json and wrangler.toml are also supported.

{
  "name": "edge-api",
  "main": "src/index.ts",
  "compatibility_date": "2026-11-01",
  "routes": [{ "pattern": "api.example.com/*", "zone_name": "example.com" }]
}

18. How do you deploy to staging and production from the same project?

Define named environments under env (for example env.staging) and deploy with wrangler deploy --env staging. The docs warn that bindings such as vars are not inherited, so each environment must define its own.

19. How do you release a Worker change to 10% of traffic first?

Upload a version without deploying it, then deploy with a percentage split.

npx wrangler versions upload --message "add cache headers"
npx wrangler versions deploy <new-version-id>@10% <current-version-id>@90% -y

Watch errors and latency, then move to 100% or back to 0%.

20. How do you roll back a bad Worker deploy?

npx wrangler rollback creates a new deployment from the previous version (or a version ID you pass), and it becomes active immediately. wrangler deployments list shows the 10 most recent deployments, so you can pick the right ID.

21. How do you see live logs from a Worker in production?

npx wrangler tail streams console output and exceptions for each request. Filters such as --status error, --method and --search cut volume, which the docs note also helps avoid sampling on busy Workers.

22. How do you store an API key for a Worker?

npx wrangler secret put PAYMENT_API_KEY prompts for the value (or reads it from stdin). Never put secrets in vars in the config file, which is plain text and usually in Git. Note that secret put creates and deploys a new Worker version immediately.

23. 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

create writes a credentials file and gives the tunnel a UUID; route dns adds a CNAME to <UUID>.cfargotunnel.com.

24. What must the ingress section of config.yml contain?

Rules that match a hostname (and optionally a path) to a local service, ending with a catch-all rule that has no hostname. Without the catch-all, cloudflared rejects the file.

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

25. How do you test ingress rules before restarting the tunnel?

cloudflared tunnel ingress validate checks the file. cloudflared tunnel ingress rule https://app.example.com/login shows which rule a URL would match, which catches ordering mistakes such as a wildcard above a specific host.

26. How do you run cloudflared as a service on Linux?

sudo cloudflared service install, then systemctl status cloudflared. Under sudo, $HOME is /root, so pass --config with the full path if your config lives in a user's home directory.

27. How do you manage DNS records with Terraform on provider v5?

Use the cloudflare_dns_record resource. The v5 upgrade guide lists cloudflare_record as renamed to cloudflare_dns_record, and recommends Cloudflare's tf-migrate tool to rewrite configurations and add moved and import blocks.

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

28. How do you bring a record created in the dashboard under Terraform?

Write the matching resource block, add an import block (or run terraform import) with the zone and record IDs, and run terraform plan until it shows no changes. Only then let the pipeline manage it.

29. How do you find drift between Terraform and the dashboard?

Run terraform plan on a schedule in CI and alert when it is not empty. Combine that with dashboard permissions that stop most people editing resources Terraform owns, and audit logs to see who changed what.

30. Where should Cloudflare API tokens live for automation?

In the CI system's secret store or a vault, injected as environment variables at run time, one token per pipeline with only the permissions it needs, and an expiry date. Rotate on a schedule and immediately if a token appears in logs or Git.

Senior: safe operations at scale (31-35)

31. How would you design a release pipeline for Workers?

Run tests, then wrangler versions upload on merge, deploy to a staging environment, run smoke tests, then a gradual production deploy (for example 10%, 50%, 100%) with error-rate checks between steps and an automatic wrangler rollback if checks fail.

32. How do you keep purge traffic within rate limits during a big content release?

Group objects by Cache-Tag so one tag purge replaces thousands of URL purges, batch URL purges (up to 100 URLs per request on most plans, 500 on Enterprise), and queue requests with retry and backoff when the API returns rate-limit errors.

33. How do you make a Tunnel highly available?

Run cloudflared replicas of the same tunnel on more than one host, each with the same credentials, managed as a service. If one host fails, the others keep serving. Monitor the tunnel status and the hosts themselves.

34. How do you migrate a large Terraform codebase to provider v5?

Pin the old provider, run tf-migrate on a branch, review the renamed resources and attribute changes, run terraform plan per workspace and require an empty or fully explained plan before upgrading the provider version in CI.

35. What do you log and alert on for Cloudflare in production?

Origin 5xx and 52x rates, cache hit ratio per hostname, WAF and rate-limit events, Worker exceptions and CPU errors, Tunnel health, and changes from the audit log. Each alert should point to a runbook with the commands above.

Live tasks (36-40)

36. Users see an old JavaScript file after a deploy. Walk through what you type.

Check headers with curl -sI for CF-Cache-Status and Age, purge the file or its tag through the API, request it again to confirm MISS then HIT, and fix the root cause by using versioned file names so future deploys do not need a purge.

37. A Worker deploy raised the error rate. What do you do in the first five minutes?

Run wrangler tail --status error to see the exception, run wrangler rollback to restore the previous version, confirm the error rate drops, then fix and redeploy through a gradual rollout.

38. A new hostname on a Tunnel returns 404. What do you check?

Run cloudflared tunnel ingress rule https://new.example.com. If it matches the catch-all, the hostname rule is missing or below a broader rule. Fix config.yml, run ingress validate, restart the service and confirm the DNS CNAME exists with tunnel route dns.

39. A CI job fails with an authentication error on the Cloudflare API. How do you debug it?

Call /user/tokens/verify with the same token from the runner. If it is inactive or expired, replace it. If it is active, check the token's permissions and zone scope, and whether IP filtering blocks the runner's egress address.

40. terraform plan wants to delete and recreate every DNS record after a provider upgrade. What happened?

The provider moved to v5 and the old cloudflare_record resources no longer map to state. Stop, revert the provider version, and do the migration with tf-migrate and moved blocks so Terraform updates addresses instead of recreating records.

Related pages

Use the Cloudflare interview preparation guide for a study plan, the 90+ Cloudflare DevOps security questions for security depth, and the Cloudflare certification questions if you are preparing for a certificate. Our DevOps training covers CI/CD, Terraform and cloud networking, in Kharadi, Pune and live online.

FAQ

What does "real-time" mean in a Cloudflare interview?

A hands-on task: call the API, purge cache, deploy or roll back a Worker, or configure a Tunnel, while explaining how you verify the result.

Should I use an API token or the Global API Key?

An API token. Cloudflare recommends tokens because they can be limited to specific permissions, zones, IP ranges and an expiry date.

Does a successful purge response mean the file is gone everywhere?

No. A 200 response confirms Cloudflare received the request. Check that CF-Cache-Status is no longer HIT.

How do I roll back a Cloudflare Worker?

Run wrangler rollback, which deploys the previous version or a version ID you choose. It takes effect immediately.

Which Wrangler config format should new projects use?

Cloudflare recommends wrangler.jsonc for new projects. wrangler.json and wrangler.toml are also supported.

Why does cloudflared reject my config file?

A common cause is a missing catch-all rule at the end of the ingress list. Run cloudflared tunnel ingress validate to see the error.

What changed for DNS records in the Terraform provider v5?

cloudflare_record was renamed to cloudflare_dns_record. Cloudflare provides the tf-migrate tool for the upgrade.

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.