302 Found
The resource is temporarily available at another URL. Follow the Location header for this request, but keep using the original address in future.
What 302 means
A 302 says "what you want is somewhere else for now". The Location header gives the temporary address. Because the redirect may change or disappear, clients should keep the original URL in bookmarks, links and configuration.
Unlike a 301, a 302 is not cacheable by default. A browser or CDN only stores it if the response carries explicit freshness information such as Cache-Control: max-age.
The code has had two names. HTTP/1.0 called it "Moved Temporarily" and some servers, nginx among them, still print that phrase. The registered name is "Found".
Why 303 and 307 exist
The original intention was that a redirected request keeps its method. Early browsers did something else: after a POST they followed a 302 with a GET. That behaviour became so common that the specification now allows it, which leaves 302 ambiguous for anything other than GET.
Two later codes remove the ambiguity:
- 303 See Other always means "now GET this other URL". It is the precise code for redirecting to a result page after a form submission.
- 307 Temporary Redirect always means "repeat the same request, same method and body, at this other URL".
For plain GET requests, 302 and 307 behave identically.
When a 302 is right, and when it is not
Good uses: sending a signed-out visitor to the login page and back afterwards, choosing a language or regional version, short-lived campaign links, and A/B tests. In each case the original URL remains the real one.
It is the wrong code for:
- A permanent move. Google treats a 302 only as a weak signal for the target, so the old URL tends to stay in the index. Use 301 or 308.
- API calls that are not GET. A client may quietly resend a redirected POST as a GET without its body. Use 307.
- A missing page. Redirecting unknown URLs to the home page hides broken links; answer 404.
Many 302s are accidents, because 302 is the default in common tools: nginx sends it for return https://example.com/; with no code and for rewrite ... redirect;, and Apache sends it for a Redirect directive without a status. If the move is permanent, write the code out.
Debugging redirect chains and loops
- Run
curl -sIL https://example.com/page. It prints the headers of every hop, so you can read each status andLocationin order. - "Too many redirects" in a browser means a loop. The usual cause is two layers that disagree: a CDN or load balancer talks plain HTTP to an origin that redirects all HTTP to HTTPS, so every attempt bounces. Have the origin look at the
X-Forwarded-Protoheader, or make the proxy connect over HTTPS. - Loops that affect only some visitors usually depend on a cookie: the login page redirects to a page that redirects back because the session cookie was not accepted.
- Check that the
Locationvalue is correctly encoded. A return address inside a query string has to be percent-encoded, which the URL encoder will do for you.
302 compared with 303, 307 and 301
| Code | Lasts | Method on the next request |
|---|---|---|
| 302 Found | Temporary | GET stays GET; POST may become GET |
| 303 See Other | Temporary | Always GET (or HEAD) |
| 307 Temporary Redirect | Temporary | Always unchanged |
| 301 Moved Permanently | Permanent | GET stays GET; POST may become GET |
Example 302 response
HTTP/1.1 302 Found
Location: /login?next=%2Faccount%2Forders
Cache-Control: no-store
Content-Length: 0A typical login redirect. The page the visitor wanted travels along percent-encoded in the next parameter, and no-store makes sure no cache replays the redirect after they have signed in.
Defined in RFC 9110, section 15.4.3.
Questions
Is a 302 redirect bad for SEO?
Not when the move really is temporary. Google follows a 302 but treats it as a weak signal, so it tends to keep the original URL indexed. That is what you want for a temporary redirect and the wrong outcome for a permanent move, where a 301 or 308 belongs.
What is the difference between 302 and 307?
For GET requests there is none. For other methods, a 307 guarantees that the client repeats the request with the same method and body, while a 302 allows it to switch to GET, which browsers do after a POST.
Why does my server say "302 Moved Temporarily"?
That was the name of the code in HTTP/1.0, and some servers such as nginx still use it as the reason phrase. It is the same status as 302 Found; clients only look at the number.
Are 302 redirects cached?
Not by default. A 302 is stored only if the response says how long it stays fresh, for example with Cache-Control: max-age. A 301, by contrast, may be cached without any such header.