HTTP 307 Temporary Redirect instructs the client to repeat the request at a different URL while preserving the HTTP method and body. Unlike 302 Found, which allows (and historically caused) method changes from POST to GET, 307 guarantees the redirect preserves the exact request. This is critical for API redirects, payment processing flows, and any scenario where a POST must remain a POST through the redirect.
Response includes the status code, standard headers (including Content-Type), and a small diagnostic JSON body describing the request and returned status.
Simulator URL (copy in the app after load — not a normal link):
https://httpstatus.com/api/status/307
Example request:
curl -i "https://httpstatus.com/api/status/307"The URL of the requested resource has been changed temporarily.
On this code, Inspector focuses on semantics, headers, and correctness warnings that commonly affect clients and caches.
307 Temporary Redirect (RFC 7231 Section 6.4.7) was created to fix 302's method-change behavior. The client MUST NOT change the method: a POST stays POST, a PUT stays PUT. The Location header contains the temporary URL. HSTS (HTTP Strict Transport Security) uses 307 internally: when a browser with an HSTS policy encounters an http:// URL for a known HTTPS-only host, it performs an internal 307 redirect to https:// before making any network request. This is visible in browser DevTools as a '307 Internal Redirect.' Caching: not cacheable by default.
app.get('/old-path', (req, res) => {
res.redirect(307, '/new-path');
});from fastapi.responses import RedirectResponse
@app.get('/old-path')
async def old_path():
return RedirectResponse('/new-path', status_code=307)@GetMapping("/old-path")
public ResponseEntity<Void> oldPath() {
return ResponseEntity.status(307)
.header("Location", "/new-path")
.build();
}func oldPathHandler(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/new-path", 307)
}