HTTPError.net

The fastest way to diagnose, understand, and fix any HTTP status code

302 Found

Fault: Neither
TL;DR

Resource temporarily moved but may return to original URL.

The resource temporarily resides at a different URL.

What HTTP 302 Found Means

The resource temporarily resides at a different URL.

Resource temporarily moved but may return to original URL.

Common Causes

What Visitors Should Do

Notes for Developers

302 vs 301 vs 307 vs 308

CodePermanent?Method on redirectTypical use
301YesMay change POST to GETMoved pages, domain or HTTPS migrations
302NoMay change POST to GETShort-term moves, login redirects
303NoAlways GETRedirect after a form POST
307NoMust keep method and bodyTemporary moves of APIs or forms
308YesMust keep method and bodyPermanent moves of APIs or forms

RFC 9110 allows clients to switch a POST to GET on a 301 or 302 for historical reasons, which is why 307 and 308 exist.

Returning a 302 Found (Code Examples)

If you build APIs or web apps, here is how to send an HTTP 302 response and how to test for it:

Node.js (Express)

app.get('/resource', (req, res) => {
  res.status(302).json({ error: 'Found' });
});

Python (Flask)

@app.route('/resource')
def resource():
    return jsonify(error='Found'), 302

PHP

<?php
http_response_code(302);
header('Content-Type: application/json');
echo json_encode(['error' => 'Found']);

Check the status with curl

curl -I https://example.com/resource
# Look for: HTTP/1.1 302 Found

Frequently Asked Questions

What does HTTP 302 Found mean?

Resource temporarily moved but may return to original URL. In short: The resource temporarily resides at a different URL.

How should I handle an HTTP 302 Found response?

Use 307 instead for temporary redirects that preserve method. Set Location header.

Official Specification

The 302 Found status code is defined in RFC 9110 Section 15.4.3.

View the IANA HTTP Status Code Registry →