307 Temporary Redirect
Temporary redirect that preserves the request method.
The request should be repeated with another URL, but future requests should still use the original URL.
What HTTP 307 Temporary Redirect Means
The request should be repeated with another URL, but future requests should still use the original URL.
Temporary redirect that preserves the request method.
Common Causes
- Temporary server maintenance
- Load balancing
- Temporary URL change
What Visitors Should Do
- Browser should automatically redirect
Notes for Developers
- Use instead of 302 to preserve HTTP method
- Set Location header
307 vs 302 vs 301 vs 308
| Code | Permanent? | Method on redirect | Typical use |
|---|---|---|---|
| 301 | Yes | May change POST to GET | Moved pages, domain or HTTPS migrations |
| 302 | No | May change POST to GET | Short-term moves, login redirects |
| 303 | No | Always GET | Redirect after a form POST |
| 307 | No | Must keep method and body | Temporary moves of APIs or forms |
| 308 | Yes | Must keep method and body | Permanent 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.
307 and HSTS
If you see a 307 Internal Redirect in Chrome DevTools when opening an http:// URL, the redirect was made by the browser itself because the site uses HSTS (HTTP Strict Transport Security). No request reached the server; the browser upgraded the URL to HTTPS on its own.
Returning a 307 Temporary Redirect (Code Examples)
If you build APIs or web apps, here is how to send an HTTP 307 response and how to test for it:
Node.js (Express)
app.get('/resource', (req, res) => {
res.status(307).json({ error: 'Temporary Redirect' });
});
Python (Flask)
@app.route('/resource')
def resource():
return jsonify(error='Temporary Redirect'), 307
PHP
<?php
http_response_code(307);
header('Content-Type: application/json');
echo json_encode(['error' => 'Temporary Redirect']);
Check the status with curl
curl -I https://example.com/resource
# Look for: HTTP/1.1 307 Temporary Redirect
Frequently Asked Questions
What does HTTP 307 Temporary Redirect mean?
Temporary redirect that preserves the request method. In short: The request should be repeated with another URL, but future requests should still use the original URL.
How should I handle an HTTP 307 Temporary Redirect response?
Use instead of 302 to preserve HTTP method. Set Location header.
Official Specification
The 307 Temporary Redirect status code is defined in RFC 9110 Section 15.4.8.