HTTP Status Codes

307 307 Temporary Redirect

The resource is temporarily at a different URL — preserve the HTTP method.

What Is This?

The HTTP 307 Temporary Redirect status code is similar to 302 but guarantees that the HTTP method and body are preserved when following the redirect. If a POST request receives a 307, the client must resend the POST request to the new URL with the same body. This makes 307 safer than 302 for API endpoints where changing GET to POST (or vice versa) would cause errors.

Common Causes & Solutions

1

Common Cause

API endpoint temporarily relocated

2

Common Cause

Load balancer redirecting to a different backend server

3

Common Cause

Maintenance mode that preserves POST request semantics

4

Use 307 for API redirects

When temporarily moving API endpoints, use 307 to ensure POST/PUT/DELETE methods are preserved correctly.

// Express.js
app.post('/api/v1/orders', (req, res) => {
  // Temporarily redirected to v2
  res.redirect(307, '/api/v2/orders')
})

Related Entries

More from this reference:

Frequently Asked Questions

What is the difference between 307 and 308?

307 is temporary (like 302) while 308 is permanent (like 301). Both preserve the HTTP method. Use 307 for temporary moves and 308 for permanent moves when method preservation is critical.

Do browsers handle 307 correctly?

Modern browsers handle 307 correctly for GET and POST. However, some older browsers and HTTP clients may fall back to 302 behavior and change POST to GET. Test your target clients when using 307.