307Temporary Redirect
Go to another address for now, and repeat the request there exactly: same method, same body.
How you get a 307
A POST arrives at an endpoint that is temporarily served elsewhere. The app sends 307 with the other address. The browser repeats the request there, and it is still a POST with the same body.
Who sends itApp · Proxy · CDN
- Browser
- CDN
- Proxy
- App
- DB
Typically the application or an API gateway, when an endpoint is temporarily served elsewhere. Proxies and CDNs send it for temporary rules that must not disturb POST requests.
In short
What a 307 Temporary Redirect means
A 307 Temporary Redirect does the same job as a 302, with one guarantee added: the client must repeat the request at the new address without changing it. A POST stays a POST and its body is sent again. That matters for APIs and uploads, where a 302 would quietly turn the request into a GET and lose the data. Like 302 it is temporary, so clients keep using the original address next time and do not store the redirect unless told to. It is typically sent by the application or a gateway while an endpoint is being served from somewhere else. Browsers also show “307 Internal Redirect” in developer tools when they upgrade a request from http to https by themselves because of HSTS. No server sent that one.
When you see a 307
1An API endpoint is temporarily served from another host or path.
How to check: Read Location, and confirm the client repeats the same method there.
curl -si -X POST https://api.example.com/v1/items -d '{}' | grep -iE '^HTTP|location'2The browser upgraded http to https by itself because of HSTS.
How to check: Developer tools show “307 Internal Redirect” and no request left the machine.
3A framework redirects to add or remove a trailing slash and uses 307 to protect POST bodies.
How to check: Location differs from the request only by the final slash. Call the canonical URL directly.
Retry or not?
Nothing to retry · Follow Location
Headers that matter
- Location
- Where to repeat the request.
- Cache-Control
- Like 302, a 307 is only cached if the response explicitly allows it.
In the real world
RFC vs real deployments
RFC 9110 defines 307 as 302 without permission to change the method. The one that surprises people is not from a server at all: when a site has HSTS enabled, Chromium-based browsers display the http-to-https upgrade as “307 Internal Redirect”. It is the browser describing its own behaviour. A client that follows a 307 must resend the body, so streaming uploads that cannot be replayed will fail at this point.
Seen in a real outage
Temporary redirects are the cautious choice because they are not remembered. The mobile carrier Three used a permanent one for a temporary situation, and customers stayed stuck on an error page after the situation had ended.
Your turn
Which code is it?
An API moves POST /v1/upload to another host for a week. Which redirect makes clients send the upload itself to the new host, and return to the old address afterwards?
Often confused with
307 questions
- What is the difference between 302 and 307?
- Both are temporary. With 302, clients usually turn a POST into a GET when they follow it. With 307 they must repeat the request unchanged, including the method and body.
- What is a 307 Internal Redirect?
- It is the browser, not a server. When a site uses HSTS, the browser upgrades http to https by itself and developer tools label that step as a 307.
- Who sends a 307?
- Typically the application or an API gateway. Proxies and CDNs send it for temporary rules that must not change POST requests.
Sources: RFC 9110: 307 Temporary Redirect (section 15.4.8) ↗ · RFC 6797: HTTP Strict Transport Security ↗ · Report a problem
Diagrams are our own simulations. All wording is original and paraphrases the linked sources.
Practise this in the DNS / HTTP track
Two-minute animated lessons, then boss fights from real outages. Free, no account needed.