INTERNET FUNDAMENTALSAI-REVIEWED

What is an HTTP redirect?

Useful first: HTTP · optional, not a requirement

Choose your depth

Stay with the essentials, or look closer.

Simple explanation
2 min read · estimate

YOUR GOALExplain why reaching a page can involve a second request.

Follow the forwarding address

An answer that points somewhere else

Imagine opening a saved link to /old-guide. Instead of returning the guide, the server replies with a redirect and a destination. A browser following that response requests the new address. Think of a notice on a shop door giving its new location: the notice is not the shop itself.

For example, a 302 Found response with Location: /new-guide can lead a browser from a GET request for the old address to a GET request for the new one.

[1] [2] [4]

The destination still has to answer

The destination produces its own response. It might return a page, another redirect or an error. A forwarding notice does not prove the final page exists.

A permanent move tells clients that the new address should replace the old one. A temporary move leaves the original address as the one to use for future visits. Those meanings differ even when both redirects appear to take you to the same page today.

[3] [4]
THE IDEA TO KEEP

A redirect supplies a destination; the client still has to request it.

ONE THING TO WATCH OUT FOR

The redirect response already contains the final page at its new address.

Following a redirect involves another request. The response to that request determines what the destination actually returns.

A QUICK CHECK, NOT A TEST
A GET request for /old-guide receives 302 with Location: /new-guide. What does a browser following it do next?
Show the explanation

Make another GET request for /new-guide. The Location header supplies the next address. Following it means sending another request, whose response can succeed or fail.

Progress is saved only in this browser.

KEEP EXPLORINGHTTP
Was this explanation clear?
Report a mistake by email
Basic explanation
3 min read · estimate

YOUR GOALDistinguish a move from a change in request method.

Choose the next request deliberately

301 and 302 do not promise to preserve POST

301 Moved Permanently describes a permanent move; 302 Found describes a temporary one. For historical compatibility, HTTP permits a client to change POST to GET when following either response. Do not choose one merely because it appears to preserve a submitted form in one test.

The HTTP guide explains why a request method matters: retrieving a result and submitting data are different operations.

[3] [4] [8]

307 and 308 keep the method and body

Use 307 Temporary Redirect for a temporary move that preserves the request method and body, or 308 Permanent Redirect for the corresponding permanent move. This describes the redirected request when the client follows it; it is not a promise that every client will automatically follow every redirect.

In a fictional upload service, a POST to /upload receives 307 with Location: /upload-here. Following it sends POST and the upload body to that destination, rather than replacing the submission with a GET.

[6] [7] [8]

303 retrieves the result of a submission

After accepting a form submission, a server can return 303 See Other and point to a confirmation resource. For an ordinary browser form flow, POST to /bookings can be followed by GET for /booking-confirmation. The follow-up retrieves the confirmation instead of resending the POST body.

More generally, 303 directs a retrieval request using GET or HEAD. It does not say that the original form address has permanently moved to the confirmation address.

[5] [8]
THE IDEA TO KEEP

Decide both whether the move is temporary and what the next request should do.

ONE THING TO WATCH OUT FOR

All redirect status codes send the same request to a different URL.

301 and 302 permit POST to become GET; 307 and 308 preserve the method and body, while 303 points to a retrieval of another resource.

A QUICK CHECK, NOT A TEST
An upload endpoint has moved temporarily. Which response preserves POST and its body when the client follows the redirect?
Show the explanation

307 Temporary Redirect. 307 combines a temporary destination with method and body preservation. 308 preserves them too, but communicates a permanent move; 303 serves a different purpose.

Progress is saved only in this browser.

KEEP EXPLORINGHTTP
Was this explanation clear?
Report a mistake by email
Advanced explanation
3 min read · estimate

YOUR GOALSeparate destination resolution, caching and chain behavior when diagnosing redirects.

Inspect the whole redirect chain

Resolve Location in context

Location can hold an absolute URL or a relative reference. For a request to https://example.com/docs/start, Location: next resolves to https://example.com/docs/next, while Location: /next resolves to https://example.com/next. The URL guide explains this resolution.

Read the status with the header. A 201 Created response can use Location to identify a newly created resource without instructing a redirect. Likewise, 304 Not Modified is a cache-validation result, not a move to a replacement URL.

[2] [8]

Permanent does not mean cached forever

301 and 308 are eligible for heuristic caching, subject to request-method rules and explicit cache controls. A cache may estimate freshness when permitted and no explicit lifetime is supplied. An explicit expiration takes precedence over such estimates.

For example, a cacheable redirect with Cache-Control: max-age=60 supplies a 60-second freshness lifetime; the word permanent does not turn that into an infinite lifetime. Temporary redirects can also be cacheable when the applicable rules and response controls allow it. Inspect the redirect response itself as well as the final page, and use the caching guide to distinguish storage from freshness.

[8] [9]

A chain must reach an answer

If /a redirects to /b and /b redirects back to /a, following the chain cannot reach a final page. Browsers detect redirect loops and report a failure. A longer chain that does terminate still requires extra requests.

For diagnosis, list each requested URL, its status, its Location value and the next request method. That record can reveal a loop or an unexpected POST-to-GET change that looking only at the final address would miss. Avoid unnecessary intermediate destinations; do not infer a measured speed improvement from their removal alone.

[1] [3] [4]
THE IDEA TO KEEP

Check each hop, its method and its cache policy; the final URL alone does not explain the journey.

ONE THING TO WATCH OUT FOR

A permanent redirect makes a cache remember it forever, regardless of response headers.

Permanence describes the move. Cache storage and freshness still follow method semantics and the applicable cache controls.

A QUICK CHECK, NOT A TEST
A cacheable 301 response includes Cache-Control: max-age=60. What does this say about freshness?
Show the explanation

It supplies a 60-second freshness lifetime, independent of the permanent-move meaning. The explicit lifetime governs freshness. A permanent move is not an instruction to disregard cache controls or to keep a stored response fresh forever.

Progress is saved only in this browser.

KEEP EXPLORINGHTTP
Was this explanation clear?
Report a mistake by email
GO STRAIGHT TO THE SOURCE

Keep asking. Check the details.

Source-checked using AI (OpenAI Codex) on . The checks covered sources, examples, and quizzes for this article version.

No human review is claimed. AI review can miss errors; check the original sources below.

  1. MDN — Redirections in HTTP
  2. MDN — Location header
  3. MDN — 301 Moved Permanently
  4. MDN — 302 Found
  5. MDN — 303 See Other
  6. MDN — 307 Temporary Redirect
  7. MDN — 308 Permanent Redirect
  8. RFC 9110 — Redirection status codes
  9. RFC 9111 — Heuristic freshness
How explanations are prepared