HTTP Redirect Status Codes (RFC 9110 Semantics)
HTTP redirects instruct clients, search bots, and API callers to fetch a resource from another URI via the Location response header. Choosing the wrong 3xx code silently breaks POST APIs, leaks link equity, or caches temporary maintenance routes in user browsers.
| Status Code | RFC 9110 Name | Browser Caching | HTTP Method Preservation | Production Use Case |
|---|---|---|---|---|
301 |
Moved Permanently | Aggressively cached | Legacy clients may convert POST -> GET |
Canonical domain/URL migrations (http -> https, apex -> www) |
302 |
Found | Not cached without explicit headers | Legacy clients may convert POST -> GET |
Temporary A/B tests, maintenance pages, geo routing |
307 |
Temporary Redirect | Not cached by default | Strictly preserves POST/PUT/DELETE & body |
Temporary API / form / webhook endpoint redirection |
308 |
Permanent Redirect | Cached permanently | Strictly preserves POST/PUT/DELETE & body |
Permanent API & webhook route moves |
The Redirect Tracer sends non-following HTTP HEAD requests hop-by-hop from our Cloudflare edge (capped at 10 hops to prevent infinite loop stalls), recording every intermediate URL, status code, and Server header. (Note: Origin endpoints returning 405 Method Not Allowed on HEAD or filtering automated User-Agents may respond differently to full browser GET requests.)
Why Redirect Chains Kill Crawl Budget & Core Web Vitals (LCP)
Every unnecessary hop in a redirect chain adds a sequential network round-trip before the browser can even begin downloading HTML, CSS, or the hero image:
- TCP + TLS Handshake Penalty: If a chain jumps across hostnames (
http://example.com->https://example.com->https://www.example.com->https://www.example.com/), the client may pay separate DNS lookup, TCP SYN/ACK, and TLS 1.3 negotiation penalties—directly inflating TTFB and Largest Contentful Paint (LCP). - Search Crawl Budget Waste: Crawlers allocate finite fetch budgets per host. Long internal redirect chains inside sitemaps, navigation menus, or canonical tags slow indexing of updated content.
- Webhook & OAuth Failures: Payment and Git webhooks frequently refuse to follow more than 1–2 redirects or drop
POSTbodies on301/302.
Canonicalization Rules: HTTP -> HTTPS & www / Apex
Configure your edge CDN or origin web server so all non-canonical combinations collapse in a single 301 (or 308) hop:
- Bad (2–3 hops):
http://example.com/pricing->https://example.com/pricing->https://www.example.com/pricing->https://www.example.com/pricing/ - Good (1 hop):
http://example.com/pricing->301 https://www.example.com/pricing/
Example single-hop Nginx configuration combining scheme and host canonicalization:
server {
listen 80;
listen 443 ssl;
server_name example.com;
return 301 https://www.example.com$request_uri;
}
HSTS Interaction & CDN Loop Pitfalls
- HSTS (
Strict-Transport-Security): Once a browser cachesStrict-Transport-Security: max-age=31536000; includeSubDomains, subsequent requests tohttp://are upgraded internally by the browser (307 Internal Redirect) without sending a plaintext HTTP hop over the wire. Ensure every subdomain supports HTTPS before enablingincludeSubDomains. - Cloudflare
FlexibleSSL Redirect Loops: Setting Cloudflare SSL/TLS encryption mode toFlexiblesends unencrypted HTTP (port 80) traffic to your origin server. If your origin Nginx/Apache config has a rule redirecting HTTP to HTTPS, every request loops endlessly (ERR_TOO_MANY_REDIRECTS). Always run Full (strict) with a valid origin TLS certificate. - Trailing Slash & Uppercase Normalization Collisions: When a CDN edge rule normalizes uppercase paths or strips trailing slashes while your CMS or framework router enforces trailing slashes, browsers bounce between
/Docs/and/docsuntil exceeding max redirect limits. Align trailing-slash behavior in one layer only.
Verify redirect chains and final effective URLs from your terminal using curl:
curl -ILs -o /dev/null -w "final=%{url_effective} code=%{http_code} hops=%{num_redirects} ttfb=%{time_starttransfer}s\n" http://example.com
curl -I http://example.com | grep -iE "http/|location:|server:"
Inspect response headers on your final landing page via Security Headers, verify TLS certificates with SSL Checker, check on-page canonical tags with SEO Analyzer, and benchmark connection timing via TCP Latency.
