3xx RedirectionRFC 9110
307Temporary Redirect
Temporary redirect — method and body must not change.
What it means
Similar to 302 but guarantees the HTTP method will not change. A POST request redirected with 307 will send a POST to the new URL, not a GET. Use this when you need to preserve the request method during a temporary redirect.
When to use it
- ✓Temporary redirect for POST requests that must stay POST
- ✓API endpoints that have temporarily moved
- ✓Maintenance redirects where method preservation matters
Code Examples
Express — method-preserving redirect
javascript
app.post('/api/v1/users', (req, res) => {
// Redirect POST to new endpoint, preserving POST method
res.redirect(307, '/api/v2/users');
});Quick Facts
Code307
CategoryRedirection
SpecRFC 9110
CommonNo
Relevant Headers
Location
The temporary URL