HTTP Status Codes & Redirect Chains: Complete Debugging Guide
Master HTTP status codes, understand redirect chains, inspect response headers, and debug website issues. Essential knowledge for developers, DevOps, and site owners.
HTTP Request/Response Basics
HTTP (HyperText Transfer Protocol) is the foundation of the web. When you visit a website, your browser:
- Sends a request to the server (GET, POST, HEAD, etc.)
- Server processes the request
- Server returns a response with a status code and headers
- Browser receives and displays the content
The status code tells your browser whether the request succeeded, failed, or requires further action (like following a redirect).
HTTP Status Code Categories
Status codes are grouped into five categories based on the first digit. Understanding each helps you diagnose website issues quickly.
2xx Success Codes
The request succeeded and the server returned the requested resource.
- 200 OK — The most common code. The request succeeded and the server returned the resource (HTML page, JSON API response, file, etc.).
- 201 Created — The request succeeded and a new resource was created (e.g., POST request that creates a new user account).
- 204 No Content — The request succeeded but there's no content to return (common for DELETE operations).
3xx Redirect Codes
The resource has moved or the request requires further action. The browser automatically follows the redirect.
- 301 Moved Permanently — The resource has permanently moved to a new URL. Browsers and search engines update bookmarks and indexes. Use 301 for permanent domain migrations or URL restructures.
- 302 Found — Temporary redirect. The resource is temporarily at a different URL but may return to the original. Search engines keep the original URL in their index.
- 304 Not Modified — The resource hasn't changed since your last request. Browser uses the cached version. Speeds up page loads.
- 307/308 — Like 301/302 but preserve the HTTP method (GET stays GET, POST stays POST). More semantically correct than 301/302.
4xx Client Error Codes
The request was invalid or the resource doesn't exist. The problem is with the request, not the server.
- 400 Bad Request — The request syntax is malformed. Check URL spelling and parameters.
- 401 Unauthorized — The request requires authentication. Log in or provide credentials.
- 403 Forbidden — You're authenticated but don't have permission. The server understood the request but refuses to fulfill it.
- 404 Not Found — The resource doesn't exist at that URL. Common for broken links or deleted pages.
- 429 Too Many Requests — You've exceeded the rate limit. Wait before retrying. APIs use this to prevent abuse.
5xx Server Error Codes
The server failed to fulfill a valid request. The problem is with the server, not your request.
- 500 Internal Server Error — Generic server error. Something went wrong but the server didn't specify what. Check server logs.
- 502 Bad Gateway — The server is acting as a proxy and received an invalid response from the upstream server. Common during deployments.
- 503 Service Unavailable — The server is temporarily down for maintenance or overloaded. Usually temporary—retry later.
Understanding Redirect Chains
A redirect tells your browser to request a different URL. A redirect chain occurs when one URL redirects to another, which redirects again.
Example Redirect Chain
1. Browser requests: http://example.com Server responds: 301 → https://example.com 2. Browser requests: https://example.com Server responds: 302 → https://www.example.com 3. Browser requests: https://www.example.com Server responds: 200 OK (final destination) User sees the page, but made 3 HTTP requests instead of 1!
Why Redirect Chains Are Bad
- Slow page loads — Each redirect requires a server round-trip, delaying content delivery. With a 300ms latency, a 3-hop chain adds 600ms to page load time.
- Mobile impact — 3G/4G latency is higher (500-1000ms per hop). Redirect chains severely impact mobile users.
- SEO penalty — Google crawlers follow redirect chains, wasting crawl budget. Long chains may not get fully indexed.
- User experience — Users perceive slower sites as broken or untrustworthy.
Best Practice: Minimize Redirects
- Zero redirects are ideal (direct URL)
- One redirect is acceptable (e.g., HTTP → HTTPS)
- Two redirects should be rare (e.g., HTTP → HTTPS → www)
- Three+ redirects are problematic and indicate poor configuration
Common Redirect Scenarios
HTTP to HTTPS
http://example.com → 301 → https://example.com
Standard for enabling SSL. One redirect is acceptable.
WWW to Non-WWW
https://www.example.com → 301 → https://example.com
Choose one (www or non-www) as canonical. Redirect one to the other. This is a second hop if you're also redirecting HTTP to HTTPS.
Domain Migration
https://old-domain.com → 301 → https://new-domain.com
Use 301 (permanent) to transfer SEO authority. Maintain redirects for 1-2 years to preserve search rankings.
Response Headers Explained
Response headers provide metadata about the response. Understanding them helps diagnose issues and verify configuration.
Common Response Headers
- Content-Type — What type of data is being sent (text/html, application/json, image/png, etc.). Tells browser how to interpret the response.
- Content-Length — Size of the response body in bytes. Useful for progress indicators and download verification.
- Cache-Control — How long the response can be cached (max-age=3600 means cache for 1 hour). Improves performance by reducing requests.
- Expires — Absolute date when the cached response expires (deprecated, use Cache-Control instead).
- Last-Modified — When the resource was last changed. Combined with 304 Not Modified, allows caching.
- ETag — Entity tag, a unique identifier for this version of the resource. Allows efficient caching.
- Server — Identifies the web server software (Apache, Nginx, IIS). Can be hidden for security.
Security Headers
- X-Frame-Options — Controls if the page can be embedded in an iframe. Prevents clickjacking attacks.
- X-Content-Type-Options — Prevents browsers from guessing content type, which can lead to XSS attacks.
- Strict-Transport-Security (HSTS) — Forces HTTPS. Prevents man-in-the-middle attacks.
- Content-Security-Policy (CSP) — Restricts what scripts can run on the page. Prevents XSS.
CORS Headers
- Access-Control-Allow-Origin — Specifies which domains can access your API (*, specific domain, or null). Browsers enforce this for cross-origin requests.
- Access-Control-Allow-Methods — Which HTTP methods are allowed (GET, POST, PUT, DELETE, etc.).
- Access-Control-Allow-Headers — Which custom headers can be sent in the request.
Debugging with HTTP Status Checker
HTTP Status Checker makes it easy to diagnose website issues.
Single URL Check
- Paste a URL (e.g., example.com or https://api.example.com/endpoint)
- Click "Check Status"
- See the final status code, response time, and full redirect chain
- Inspect all response headers with "View All Headers"
Batch URL Check
- Switch to "Batch Check" mode
- Paste multiple URLs (one per line, max 50)
- Click "Check All URLs"
- See a summary table with status codes, response times, and categories
- Identify broken links (404s), redirect issues, or slow servers
Real-World Example
Checking: old-website.com Result: - Request 1: http://old-website.com → 301 (Moved Permanently) - Request 2: https://old-website.com → 302 (Found) - Request 3: https://new-website.com → 200 (OK) - Response Time: 850ms - Final URL: https://new-website.com Issue: Two unnecessary hops! Optimize to redirect directly from http://old-website.com → https://new-website.com
Impact on Performance & SEO
Performance Impact
Each redirect adds latency. For a page with 100ms baseline, adding redirects increases load time:
- No redirects: 100ms (baseline)
- 1 redirect (300ms latency): 400ms (+300%)
- 2 redirects: 700ms (+600%)
- 3 redirects: 1000ms (+900%)
This directly impacts user experience, bounce rates, and Google rankings (which favor faster sites).
SEO Impact
- 301 vs 302: Use 301 for permanent moves to transfer SEO authority. 302 doesn't transfer authority, hurting rankings.
- Crawl efficiency: Google has a limited crawl budget. Long redirect chains waste crawl budget, reducing indexed pages.
- Link juice flow: Each redirect slightly degrades link equity flow. Long chains lose more value.
Best Practices
For HTTP Status Codes
- Use 301 for permanent redirects (domain migration, URL structure changes).
- Use 302 for temporary redirects (temporary URL, A/B testing, seasonal changes).
- Return correct status codes for API endpoints (200 for success, 400 for bad input, 401 for auth, 404 for not found).
- Don't silently fail — return appropriate error codes so clients know what went wrong.
For Redirect Chains
- Minimize redirects to zero if possible. Update bookmarks and links directly to the new URL.
- One redirect is acceptable (e.g., HTTP to HTTPS). Anything more is a performance cost.
- Consolidate your redirect rules. If you're redirecting HTTP → HTTPS and www → non-www, combine them server-side.
- Maintain permanent redirects for 1-2 years after domain migrations to preserve SEO rankings.
For Response Headers
- Enable caching with Cache-Control headers. Reduces requests and server load.
- Add security headers (X-Frame-Options, X-Content-Type-Options, CSP) to protect against attacks.
- Enable CORS correctly. Don't use * for access-control-allow-origin if you can be more specific.
- Compress responses with Content-Encoding: gzip to reduce bandwidth (handled by most servers).
Conclusion
Understanding HTTP status codes and redirect chains is essential for:
- Debugging website issues quickly
- Optimizing site performance
- Maintaining SEO rankings during migrations
- Building reliable APIs
- Ensuring security and compliance
Use HTTP Status Checker to audit your site and identify optimization opportunities. Regular checks catch broken links, redirect issues, and security misconfigurations before they impact users.