Skip to content
3xx · redirectSent by App | Proxy | CDN

302Found

What you asked for is at another address for now. Keep using the original address next time.

How you get a 302

The visitor is not logged in. The app decides this request belongs elsewhere and the app sends 302 pointing at the login page. The browser follows it by itself and gets a 200.

Who sends itApp · Proxy · CDN

  1. Browser
  2. CDN
  3. Proxy
  4. App
  5. DB

Typically the application, for decisions that depend on the request, such as sending a logged-out visitor to the login page. Proxies and CDNs send it for temporary rules.

In short

What a 302 Found means

A 302 Found says the thing you asked for is temporarily at another address, given in the Location header, and that the original address is still the right one to use next time. The browser follows it straight away with a second request. Because the answer may be different tomorrow, a 302 is not stored unless the response explicitly allows caching, which makes it the safe choice while a redirect might still change. It is typically sent by the application, since temporary redirects usually depend on who is asking: not logged in, wrong region, feature switched off. One long-standing quirk: when the original request was a POST, nearly every client follows the 302 with a GET. That behaviour is so common that the standard added 303 to ask for it on purpose and 307 to forbid it.

When you see a 302

  1. 1The app sends logged-out visitors to a login page.

    How to check: Read Location. Repeat the request with a valid session and the redirect should go away.

    curl -sI https://example.com/account | grep -iE '^HTTP|location'
  2. 2A form was submitted and the app redirects to a result page, so a reload does not resubmit.

    How to check: In the browser's network tab the POST shows 302, followed by a GET.

  3. 3A temporary rule: maintenance page, A/B test, or routing by country.

    How to check: Send the same request from another region or with other cookies and compare Location.

  4. 4A redirect loop: two rules send the browser back and forth.

    How to check: Follow with a hop limit and look for the same two addresses repeating.

    curl -sIL --max-redirs 10 https://example.com/ | grep -i location

Retry or not?

Nothing to retry · Follow Location

Nothing failed. Request the address in Location this time, and keep using the original address for future requests.

Headers that matter

Location
Where to go this time.
Cache-Control
A 302 is not stored by default. It is only cached if this header, or Expires, says so.
Set-Cookie
Often set on the same response, for example a session cookie after login. Browsers apply it before following.

In the real world

RFC vs real deployments

RFC 9110 says a client may change POST to GET when following a 302, and notes this is historical. In practice it is nearly universal, and the post-then-redirect pattern on the web depends on it. The RFC's precise tools are 303 See Other, which always means “now GET this other address”, and 307, which forbids changing the method. Many frameworks still default to 302 where 303 is what they mean.

Seen in a real outage

Choosing between temporary and permanent matters most when the redirect is conditional. The mobile carrier Three used a permanent redirect for a temporary condition, running out of data, and browsers kept obeying it after the condition had passed.

Your turn

Which code is it?

A form POSTs to /orders. The server saves the order and answers 302 with Location: /orders/42. What does a typical browser send next?

Often confused with

302 questions

What is the difference between 301 and 302?
A 301 is permanent: clients should switch to the new address and may remember it. A 302 is temporary: clients follow it this time and keep asking the original address in future.
Who sends a 302?
Typically the application, because temporary redirects usually depend on the request, such as login state. Proxies and CDNs send it for temporary rules.
Does a 302 change POST to GET?
The standard allows it and almost every client does it. Use 307 to keep the method, or 303 to ask for a GET explicitly.

Sources: RFC 9110: 302 Found (section 15.4.3) ↗ · RFC 9110: 303 See Other (section 15.4.4) ↗ · Report a problem

Diagrams are our own simulations. All wording is original and paraphrases the linked sources.

Practise this in the DNS / HTTP track

Two-minute animated lessons, then boss fights from real outages. Free, no account needed.

Start the track