Cloudflare

Two settings cause most of the errors people blame on Cloudflare.

3guides Feed

Cloudflare is several products sharing a dashboard. For a developer running their own servers, three of them matter: DNS with the proxy in front, Workers for code at the edge, and Tunnel for reaching a host with no open ports.

Reach for the proxy when you want a public origin protected — caching, TLS termination, WAF rules and an origin IP that is not in public DNS. Reach for Workers when there is no origin server worth running. Reach for Tunnel when the origin must exist but should not be reachable from the internet at all.

Almost every “Cloudflare is broken” report traces to two settings. The proxy status on the DNS record decides whether traffic goes through Cloudflare or straight to your IP. The zone’s SSL/TLS encryption mode decides how Cloudflare talks to your origin. Flexible mode plus an HTTPS redirect on the server is an infinite loop, and it is the single most common misconfiguration.

The second cluster of problems is the 5xx error codes. They are specific and worth learning: 521 means the connection was refused, 522 means it timed out — which is nearly always a firewall — 525 means the TLS handshake failed, and 526 means the origin certificate did not validate under Full (strict).

The third is forwarded headers. Once traffic arrives through a proxy, your application sees the proxy unless you tell it which addresses to trust. Getting that wrong produces access logs full of Cloudflare IPs and applications that think every request is plain HTTP.

Start here

How to Point a Cloudflare Domain at Your VPS

Create the A record, pick the right proxy status, set the SSL mode to Full (strict) and lock the origin so only Cloudflare can reach it — plus what errors 521, 522, 525 and 526 actually mean.

Beginner · 4 min read

Beginner to advanced

A reading order that builds Cloudflare knowledge in the sequence it is actually needed.

  1. Start How to Point a Cloudflare Domain at Your VPS 4 min
  2. Build How to Deploy an Astro Site to Cloudflare Workers 4 min
  3. Operate How to Run Cloudflare Tunnel in Front of Traefik 4 min

Common problems

Failure modes that come up repeatedly with Cloudflare, and where each one is solved.

Error 521 or 522 after enabling the proxy
Cloudflare reached your IP and was refused (521) or timed out (522). Nothing listening on 443, or a firewall dropping Cloudflare's ranges.
Endless redirect loop on every page
The zone is on Flexible encryption mode, so Cloudflare talks HTTP to an origin that redirects to HTTPS. Switch to Full (strict).
Access logs show Cloudflare IPs instead of visitors
The origin is not configured to trust the forwarded headers. Add the Cloudflare ranges to your proxy's trusted-IP list.
SSH stops working after proxying the domain
Proxied records only carry HTTP and HTTPS on supported ports. Use a DNS-only record for SSH, or move it behind a tunnel.

Latest Cloudflare guides

Browse the archive
  • beginner

    How to Point a Cloudflare Domain at Your VPS

    Create the A record, pick the right proxy status, set the SSL mode to Full (strict) and lock the origin so only Cloudflare can reach it — plus what errors 521, 522, 525 and 526 actually mean.

    4 min
  • advanced

    How to Run Cloudflare Tunnel in Front of Traefik

    Expose Docker services through Cloudflare with no inbound ports open — cloudflared plus Traefik, the forwarded-header setting that trips people up, and how to verify the firewall is closed.

    4 min
  • intermediate

    How to Deploy an Astro Site to Cloudflare Workers

    Ship a static or server-rendered Astro site to Cloudflare Workers with Wrangler — adapter setup, wrangler.jsonc, nodejs_compat, secrets, custom domains and the errors you hit on the first deploy.

    4 min

Recently updated

  • intermediate

    How to Deploy an Astro Site to Cloudflare Workers

    Ship a static or server-rendered Astro site to Cloudflare Workers with Wrangler — adapter setup, wrangler.jsonc, nodejs_compat, secrets, custom domains and the errors you hit on the first deploy.

    4 min

Frequently asked questions

What does the orange cloud actually do?

It routes the hostname through Cloudflare's network rather than answering with your server's address. You get caching, the WAF and a hidden origin IP, and you lose the ability to use non-HTTP protocols on that hostname.

Which SSL/TLS mode should I use?

Full (strict), with either a publicly trusted certificate or a Cloudflare Origin CA certificate on the origin. Flexible causes redirect loops and Full without strict accepts any certificate, including expired ones.

Do I need Cloudflare Tunnel if I already allowlist Cloudflare IPs?

Not strictly, but the tunnel is a stronger position. An IP allowlist still requires an open inbound port and a correct firewall; a tunnel needs neither, because all connections are outbound from your host.

Sources

  1. Cloudflare DNS documentation Cloudflare Primary source
  2. SSL/TLS encryption modes Cloudflare Primary source
  3. Cloudflare Tunnel Cloudflare Primary source