307 Temporary Redirect

307 Temporary Redirect is similar to 302 Found in that it tells a client to temporarily redirect to a different location to access the requested resource.

The difference from 302 is that with a 307, the client must follow the location and issue the exact same request again. So if it did a POST request on the orginal resource, it should follow the redirect and do the POST request again.

This is unlike a 302 where a client may change the request to a GET. In practice all clients change their HTTP request to a GET.

I tested Firefox, Curl and Chrome. For each of them I tested doing a POST request. Each of them redirected and did an identical request on the target url. In the case of Firefox and Chrome, I tested both a HTML form and the Fetch API.

I couldn’t test Edge and Safari, but assuming their behavior is similar, I think it problaby makes more sense to always use 307 Temporary Redirect or 303 See Other in cases where most people use 302 Found today.

Stop using 302, and start using 307 and 303!

Example

HTTP/1.1 307 Temporary Redirect
Server: gws
Location: https://evertpot.com/http/307-temporary-redirect

References

HTTP series

This article is part of an ongoing series about the HTTP protocol.

If you want to follow along as I write them, you can Subscribe to my Atom feed or Mailing list.

Informational 1xx

Successful 2xx

Redirection 3xx

Client Error 4xx

Web mentions