HTTP 307 Temporary Redirect — Method-Preserving Redirect
Informational3xx redirection
Overview
HTTP 307 Temporary Redirect instructs the client to repeat the request at a different URI while preserving the original HTTP method and body.
Key Details
- 307 guarantees the HTTP method and body are not changed during redirect
- A POST request redirected with 307 will be resubmitted as POST to the new URL
- Introduced to fix ambiguity in 302 where browsers changed POST to GET
- HSTS (HTTP Strict Transport Security) uses 307 internally to redirect HTTP to HTTPS
- The redirect is temporary — clients should continue using the original URL
Common Causes
- HSTS enforcement redirecting HTTP to HTTPS internally in the browser
- Load balancer temporarily routing traffic to a different backend
- API gateway redirecting requests while preserving method and body
- Server maintenance requiring temporary rerouting without method change
Steps
- 1Check the Location header in the response for the redirect target
- 2If unexpected 307 loops occur, check HSTS settings and preload list
- 3Clear HSTS cache in browser: chrome://net-internals/#hsts (Chrome)
- 4For server config, use 307 instead of 302 when POST body must be preserved
- 5Test with curl -X POST -d 'data' -v -L to verify method preservation
Tags
http307temporary-redirecthstsmethod-preserving
More in 3xx Redirection
http-300-multiple-choicesHTTP 300 Multiple Choices — What It Means & How to Fix It
Warninghttp-301-moved-permanentlyHTTP 301 Moved Permanently — What It Means & How to Fix It
Warninghttp-302-foundHTTP 302 Found — What It Means & How to Fix It
Warninghttp-303-see-otherHTTP 303 See Other — What It Means & How to Fix It
Warninghttp-304-not-modifiedHTTP 304 Not Modified — What It Means & How to Fix It
Warninghttp-305-use-proxyHTTP 305 Use Proxy — What It Means & How to Fix It
WarningFrequently Asked Questions
HSTS forces browsers to internally redirect HTTP to HTTPS using 307, ensuring the request method is preserved.