pingrobot

HTTP status codes / 307

307 Temporary Redirect — HTTP Status Code

· 4 min read

Short answer

307 Temporary Redirect means the resource is temporarily at another URL, and the client must repeat the request there with the same method and body. It is the strict version of 302, where a POST could be turned into a GET. Clients keep using the original URL for future requests.

307 Temporary Redirect sends a client to another URL for now, with one strict condition: the follow-up request must use the same method and carry the same body. A POST stays a POST, a PUT stays a PUT. That makes 307 the safe temporary redirect for APIs and form endpoints.

What 307 means

RFC 9110 (Section 15.4.8) defines 307 as the target resource residing temporarily under a different URI, where the user agent must not change the request method if it follows the redirect automatically. Because the redirection can change over time, the client ought to keep using the original URI for future requests. The server should provide the temporary URI in Location.

Compared with its siblings:

Code Permanence Method on follow-up
302 Found Temporary May change POST to GET
307 Temporary Redirect Temporary Must stay the same
303 See Other Points to a different resource GET (or HEAD)
308 Permanent Redirect Permanent Must stay the same

307 was added to HTTP so that servers had an unambiguous way to ask for a method-preserving temporary redirect, after 302 came to mean "switch to GET" in practice. It is not heuristically cacheable: caches only store it with explicit cache headers.

When you see it

  • APIs during maintenance or failover. Traffic to api.example.com/v1/orders is temporarily sent to a standby region, and the POST must arrive there intact.
  • Load balancers and gateways that send clients to a specific node or region for a while.
  • Framework defaults for temporary redirects. Next.js, for example, uses 307 for redirects configured as non-permanent.
  • Browser HSTS upgrades. Chrome's developer tools show a 307 Internal Redirect when the browser itself upgrades http:// to https:// for a site on its HSTS list. No response came from the server; the browser generated it.
  • Object storage and CDNs that temporarily send requests to another endpoint while data moves.

Things to keep in mind

  1. The body is sent twice. For a large upload, the client transfers the body to the first server, gets the 307, then transfers it again to the new location. Point large uploads straight at the right endpoint when you can.
  2. Credentials may not follow. RFC 9110 tells clients to drop or reconsider headers such as Authorization and Cookie when following redirects, especially to a different host. An API redirected cross-origin may therefore see the follow-up arrive unauthenticated.
  3. Unsafe methods and user consent. The RFC notes that automatic redirection of methods that are not safe needs care, because the user might not want the request repeated somewhere else.
  4. Temporary should stay temporary. If a 307 has been in place for months and is not going away, a 308 tells clients and search engines the truth.

SEO notes

Google's Search Central documentation treats 307 like 302: a temporary redirect, so the original URL generally stays in search results. For a permanent move, 301 or 308 sends the stronger signal.

How to check it

Without following:

curl -I https://api.example.com/v1/status
HTTP/2 307
location: https://api-eu.example.com/v1/status

To see the method being kept, follow a POST with verbose output and compare the request lines:

curl -sv -L -o /dev/null -d '{"ping":1}' \
  -H "Content-Type: application/json" https://api.example.com/v1/echo 2>&1 | grep -E "^> (POST|GET)"

Two > POST lines mean the method was preserved across the 307. Run the same command against a URL that answers 302 and curl, by default, sends the second request as GET. Avoid adding -X POST here: it forces POST on every hop and hides the difference.

What it means for uptime monitoring

PingRobot's checker sends a GET, follows redirects, and evaluates the final response: 200 to 399 is up, anything else down. Since the check is a GET, 307 and 302 behave the same for it, and the verdict depends entirely on what the temporary destination returns.

That is useful during failovers. If a 307 sends traffic to a standby that is itself failing, the monitor reports the standby's status, such as a 503, not a misleading "redirect succeeded." A redirect loop between two regions never produces a final response, so the check fails with an error.

If you run a planned temporary redirect, keep the monitor on the original URL: that is the address your users and integrations call, and when the redirect is removed the monitor keeps working without changes.

Start monitoring free — 10 monitors, no credit card.

Frequently asked questions

What is the difference between 307 and 302?

Both are temporary redirects. With 302, browsers may change a POST to a GET and drop the body. With 307, the method and body must stay exactly the same.

Why does Chrome show 307 Internal Redirect for my site?

That is usually the browser itself applying HSTS, upgrading an http link to https before any request leaves the machine. The server did not send it, so it will not appear in your server logs or in curl.

When should I use 307 instead of 308?

Use 307 when the move is temporary, such as maintenance, a failover or a short campaign. Use 308 when the new URL is permanent and clients should update their links.