Infrastructure & Networking

What is Cloudflare?

Cloudflare is a web infrastructure and security company that operates one of the world’s largest edge networks: providing CDN, DDoS protection, DNS hosting, reverse proxy services, edge computing, and security services to millions of websites and internet properties. Founded in 2009 and launched publicly in 2010 Cloudflare has grown from a web application firewall startup into a comprehensive internet infrastructure provider whose network sits between a significant fraction of all internet users and the websites they visit.

Cloudflare’s core product is its reverse proxy service, when a website uses Cloudflare all traffic to that website flows through Cloudflare’s network before reaching the origin server. Cloudflare’s edge servers handle DDoS mitigation, security filtering, SSL termination, HTTP caching, and performance optimisations before forwarding legitimate requests to the origin. This network intermediary position enables Cloudflare to provide comprehensive protection and performance improvements without requiring changes to the origin server software or configuration.

For redirect management Cloudflare is significant in several ways, it provides redirect rule configuration through its dashboard and API, it serves redirect responses from edge locations near users for minimal latency, it automatically provisions SSL certificates for connected domains enabling HTTPS redirect serving, and it underpins many dedicated redirect management platforms that build their infrastructure on Cloudflare’s network. Understanding how Cloudflare works provides context for how modern redirect management infrastructure operates at global scale.

How Cloudflare works

Cloudflare operates as a transparent intermediary between internet users and origin servers, sitting in the request-response path for all traffic to connected websites.

DNS-based routing: connecting a website to Cloudflare involves changing the domain’s nameservers to Cloudflare’s nameservers, or adding specific DNS records if using Cloudflare’s partial setup. Once Cloudflare controls the domain’s DNS the A records and AAAA records returned for the domain point to Cloudflare’s IP addresses rather than the origin server’s IP. Browser connections to the domain reach Cloudflare’s edge network first, not the origin directly.

This DNS-based interception is the mechanism through which Cloudflare inserts itself into the traffic path. The origin server’s actual IP address is hidden, only Cloudflare knows the origin IP and uses it to forward legitimate requests.

Anycast network: Cloudflare uses anycast routing, the same IP addresses are announced from all of Cloudflare’s 200+ points of presence globally. When a user’s device resolves a Cloudflare-proxied domain and connects to the returned IP address the network routing infrastructure automatically directs the connection to the nearest Cloudflare edge node. A user in Tokyo connects to Cloudflare’s Tokyo or Osaka edge. A user in London connects to Cloudflare’s London edge. The same IP address routes different users to different physical servers based on network proximity.

Request processing at the edge: each Cloudflare edge node processes incoming requests through a pipeline of checks and transformations. DDoS detection and mitigation filters volumetric attack traffic. Web Application Firewall rules inspect request content for attack patterns. Bot management distinguishes legitimate traffic from automated abuse. Rate limiting controls request frequency per IP. Workers, Cloudflare’s edge computing platform, execute custom JavaScript logic for request and response transformation. After processing legitimate requests are forwarded to the origin server.

Response caching: Cloudflare’s edge nodes cache responses from origin servers according to Cache-Control headers and Cloudflare’s configured caching rules. Cached responses are served directly from edge nodes without forwarding requests to the origin, reducing origin load and improving response times. Cloudflare provides cache control through its dashboard, configuring cache durations, cache bypass rules, and cache purging.

Cloudflare products and services

Cloudflare has expanded far beyond its original CDN and DDoS protection focus, building a comprehensive suite of internet infrastructure products.

Cloudflare CDN: the core product. Caches and serves website content from edge nodes near users, reducing latency for static and cacheable content. Cloudflare’s CDN integrates with its security services, all CDN traffic benefits from DDoS protection, WAF, and bot management. Cloudflare CDN is enabled automatically for any domain proxied through Cloudflare.

Cloudflare DNS: one of the world’s fastest and most resilient authoritative DNS services. Cloudflare manages DNS records for millions of domains, providing fast DNS resolution, high availability, and DNSSEC support. Cloudflare’s DNS infrastructure serves billions of DNS queries daily. The 1.1.1.1 service is Cloudflare’s public recursive DNS resolver, a free, privacy-focused alternative to ISP resolvers.

DDoS protection: Cloudflare’s network absorbs DDoS attacks at the edge, distributing attack traffic across its global network before it reaches origin servers. Cloudflare’s scale, handling petabits per second of traffic, enables it to absorb attacks that would overwhelm any individual origin server. DDoS protection is included in all Cloudflare plans including the free tier.

Web Application Firewall, WAF: inspects HTTP request content for known attack patterns, SQL injection, cross-site scripting, path traversal. Cloudflare’s WAF uses managed rulesets, maintained by Cloudflare’s security team, alongside custom rules configured by site operators. WAF processing happens at the edge before requests reach the origin, blocking malicious requests before they consume origin resources.

Cloudflare Workers: edge computing platform executing JavaScript at Cloudflare’s edge nodes. Workers can intercept and modify HTTP requests and responses, implementing custom logic at the edge without origin server involvement. Workers execute in V8 isolates, extremely fast cold starts measured in microseconds, enabling per-request processing at edge scale. Workers are used for A/B testing, personalisation, authentication, and complex redirect logic at the edge.

Cloudflare Pages: static site hosting and JAMstack deployment platform. Developers deploy static sites directly to Cloudflare’s edge network, sites are served from all edge nodes globally. Cloudflare Pages integrates with Workers for server-side functionality at the edge.

Cloudflare R2: object storage compatible with the S3 API. Stores files at the edge without egress bandwidth fees, unlike AWS S3 which charges for data transfer out. R2 is used for media storage, static asset hosting, and backup storage.

Zero Trust products: Cloudflare Access provides identity-based access control for internal applications, replacing VPNs with identity verification at the edge. Cloudflare Tunnel, formerly Argo Tunnel, creates encrypted tunnels from origin servers to Cloudflare’s network without exposing origin IP addresses or opening inbound firewall rules.

Cloudflare redirect management

Cloudflare provides several mechanisms for configuring and serving redirects: from simple dashboard rules to programmable edge logic.

Page Rules, legacy redirect mechanism: Cloudflare’s original redirect configuration interface. Page Rules match URL patterns and apply actions, including forwarding URL redirects. A Page Rule matching http://example.com/* with a forwarding URL action of https://example.com/$1 implements HTTP-to-HTTPS redirection for all paths on the domain. Page Rules support wildcard matching, * matches any sequence of characters, and capture groups, $1 refers to the first wildcard match.

Page Rules are being superseded by the newer Rules framework but remain widely used. Free Cloudflare plans include 3 Page Rules, paid plans include more.

Cloudflare Redirect Rules, new redirect mechanism: Cloudflare’s current redirect configuration system built on the Rules framework. Redirect Rules provide more powerful matching, using Cloudflare’s expression language to match on any request attribute, hostname, path, query string, headers, IP address, geographic location. Redirect Rules support both static and dynamic redirect destinations, preserving path and query string components through redirect rules.

Redirect Rules are configured through the Cloudflare dashboard or API under the Rules section. They execute at the Cloudflare edge before requests reach the origin, returning redirect responses directly from the edge without origin involvement.

Cloudflare Workers for complex redirects: for redirect logic beyond what Redirect Rules support, database-driven redirects, complex conditional logic, integration with external systems, Cloudflare Workers implement custom redirect logic at the edge. A Worker can fetch redirect mappings from KV storage, apply complex pattern matching, and return redirect responses entirely from the edge.

// Simple Workers redirect example
addEventListener('fetch', event => {
    event.respondWith(handleRequest(event.request))
})

async function handleRequest(request) {
    const url = new URL(request.url)
    
    if (url.pathname === '/old-page') {
        return Response.redirect('https://example.com/new-page', 301)
    }
    
    return fetch(request)
}
// Simple Workers redirect example
addEventListener('fetch', event => {
    event.respondWith(handleRequest(event.request))
})

async function handleRequest(request) {
    const url = new URL(request.url)
    
    if (url.pathname === '/old-page') {
        return Response.redirect('https://example.com/new-page', 301)
    }
    
    return fetch(request)
}
// Simple Workers redirect example
addEventListener('fetch', event => {
    event.respondWith(handleRequest(event.request))
})

async function handleRequest(request) {
    const url = new URL(request.url)
    
    if (url.pathname === '/old-page') {
        return Response.redirect('https://example.com/new-page', 301)
    }
    
    return fetch(request)
}

Automatic HTTPS rewrites: Cloudflare’s Automatic HTTPS Rewrites feature rewrites HTTP links in page content to HTTPS, reducing mixed content warnings caused by HTTP resource links on HTTPS pages. This feature operates on response content, transforming HTTP URLs in HTML responses to HTTPS, without redirecting the page requests themselves.

Always Use HTTPS: Cloudflare’s setting that redirects all HTTP requests to HTTPS automatically. Enabling Always Use HTTPS implements the HTTP-to-HTTPS redirect at the Cloudflare edge for the entire domain, without requiring origin server configuration. The redirect fires from Cloudflare’s edge nodes, fast redirect response from nearby infrastructure without origin involvement.

Cloudflare SSL and HTTPS

Cloudflare significantly simplifies HTTPS deployment, providing SSL certificate management, TLS configuration, and HTTPS enforcement at the edge.

Universal SSL: Cloudflare automatically provisions free SSL certificates for all domains using Cloudflare’s proxy. Universal SSL certificates cover the root domain and first-level subdomains, example.com and *.example.com. Certificate provisioning happens automatically within minutes of activating Cloudflare proxy, no manual certificate request, validation, or installation required. Certificates are renewed automatically before expiry.

Universal SSL enables immediate HTTPS for any domain connected to Cloudflare, even if the origin server has no SSL certificate or only HTTP access. Cloudflare terminates HTTPS at the edge and can connect to the origin over HTTP on a private network, though full end-to-end encryption with origin SSL is recommended.

Advanced certificates: Cloudflare’s paid certificate options for custom certificate requirements, custom hostnames beyond the Universal SSL coverage, dedicated IP addresses, custom certificate authorities, and longer validity periods.

TLS configuration: Cloudflare provides TLS version and cipher suite configuration at the edge. Minimum TLS version settings prevent connections from clients using deprecated TLS versions. Cipher suite configuration controls which encryption algorithms are permitted. TLS 1.3 is supported and enabled by default, providing the fastest TLS handshake and strongest security.

HSTS at the Cloudflare edge: Cloudflare can add HSTS headers to all HTTPS responses, instructing browsers to always use HTTPS for the domain. HSTS configuration in Cloudflare applies at the edge, all HTTPS responses include the Strict-Transport-Security header regardless of whether the origin sets it. HSTS preload registration can be initiated through Cloudflare’s dashboard.

Cloudflare as redirect management infrastructure

Many dedicated redirect management platforms are built on Cloudflare’s infrastructure, using Cloudflare Workers and edge capabilities to provide redirect management as a service.

Edge execution for low-latency redirects: redirect management platforms using Cloudflare Workers execute redirect rules at Cloudflare’s edge nodes globally. A user in any location receives their redirect response from the nearest Cloudflare edge, typically within 10-30 milliseconds. Origin round trips for redirect processing are eliminated, the Worker executes the redirect logic entirely at the edge.

KV storage for redirect rule databases: Cloudflare KV, a globally distributed key-value store, stores redirect rule configurations accessible from Workers at every edge node. When a Worker receives a redirect request it looks up the rule in KV, the lookup is served from the nearest KV replica rather than from a central database. KV-based rule lookups add only a few milliseconds to redirect processing, making edge-executed database-driven redirects nearly as fast as static redirect rules.

Custom domain SSL automation: redirect management platforms connecting many customer domains to Cloudflare infrastructure use Cloudflare’s SSL for SaaS feature, automatically provisioning SSL certificates for custom domains. When a customer connects their domain to the redirect platform Cloudflare provisions a certificate for that domain within minutes, enabling HTTPS redirect serving immediately without manual certificate management.

Global rule propagation: redirect rules stored in Cloudflare KV propagate globally within seconds, all edge nodes have access to updated rules almost immediately after changes are made. This near-instant global propagation ensures redirect configuration changes take effect worldwide within seconds rather than requiring time-consuming CDN cache purging or configuration deployment processes.

Common Cloudflare redirect scenarios

HTTP to HTTPS redirect: enabling Always Use HTTPS in Cloudflare’s SSL/TLS settings implements the universal HTTP-to-HTTPS redirect for all paths on the domain from Cloudflare’s edge, no origin server configuration required.

www to non-www redirect: a Page Rule or Redirect Rule matching www.example.com/* and forwarding to https://example.com/$1 implements the www-to-non-www canonical redirect at the edge.

Domain migration redirects: configuring the old domain in Cloudflare with Redirect Rules that forward all paths to the equivalent paths on the new domain, path-preserving domain migration redirects served from Cloudflare’s edge.

Geographic redirects: Cloudflare Redirect Rules can match on the geographic location of the visitor’s IP address, routing users in specific countries to localised versions of the site. ip.geoip.country eq "DE" matches visitors from Germany, enabling Germany-specific redirect destinations.

Related terms

Related terms

Ready to keep every link alive?

Ready to keep every link alive?

Ready to keep every link alive?