307 Temporary Redirect

Like 302, but the client must repeat the same method and body at the new address.

Code
307
Reason phrase
Temporary Redirect
Class
3xx Redirection
Defined in
RFC 9110 section 15.4.8
Cacheable by default
No

What it means

Redirection: the client has to take another step, usually following a Location header, to complete the request.

When a server should send it. For a temporary redirect where the method and body must stay the same, such as an API endpoint answering POST from another address for a while. HSTS shows up in browser developer tools as an internal 307 from http to https.

Common causes. Redirecting an API POST, or HSTS sending a browser from http to https.

What to do. Follow the Location header with the same method.

How clients and crawlers treat it

Browsers and HTTP clients. Browsers repeat the exact request, method and body included, at the new address. It is not cached by default.

Google Search. Treated like 302: a weak signal that the redirect target should be canonical. Source: Google Search Central, How HTTP status codes, and network and DNS errors affect Google Search.

Caching. Not cacheable by default (RFC 9110 section 15.1 does not list it). A cache stores it only when the response says so with Cache-Control or Expires.

Example response

HTTP/1.1 307 Temporary Redirect
Location: https://api.example.com/v2/upload

Temporary Redirect

How to send 307

nginx
location = /old-page {
    return 307 https://example.com/new-page;
}
Apache (.htaccess)
Redirect 307 /old-page https://example.com/new-page
PHP
header('Location: https://example.com/new-page', true, 307);
exit;
Node.js
res.writeHead(307, { Location: 'https://example.com/new-page' });
res.end();
Python (Flask)
from flask import redirect

return redirect('https://example.com/new-page', code=307)

Change the paths to suit. In nginx, add_header needs always to apply to error responses.

Related codes

All status codes · All 3xx codes

Names and numbers from the IANA HTTP Status Code Registry. Google Search behaviour as documented by Google Search Central.