Skip to content

HTTP Response Status Code 307 Temporary Redirect

What is HTTP Response Status Code 307 Temporary Redirect?

HTTP response status code 307 Temporary Redirect indicates that the requested resource is temporarily available at a different URL, and the client should use the provided URL while maintaining the original request method.

When is HTTP Response Status Code 307 Temporary Redirect Used?

The 307 status code is used when a resource is temporarily relocated. Unlike a 302 redirect, it ensures that the original HTTP method (e.g., POST, GET) is preserved when making the request to the new URL.

Example 1: Redirecting to a Temporary URL

# Client sends a POST request to submit a form.
POST /submit-form HTTP/1.1
Host: www.example.com
Content-Type: application/x-www-form-urlencoded

name=John&[email protected]

# Server Response
HTTP/1.1 307 Temporary Redirect
Date: Wed, 09 Oct 2024 13:10:00 GMT
Server: Nginx/1.18.0
Location: https://www.example.com/temp-submit

# The server redirects the client to a temporary location but retains the POST method.

Example 2: Redirecting API Calls to a Temporary Endpoint

# Client sends a GET request to an API endpoint.
GET /api/user/123 HTTP/1.1
Host: api.example.com

# Server Response
HTTP/1.1 307 Temporary Redirect
Date: Wed, 09 Oct 2024 13:12:00 GMT
Server: Apache/2.4.41 (Ubuntu)
Location: https://api.example.com/temp-user/123

# The server temporarily redirects the client to a new API endpoint while keeping the GET method.

Summary

The HTTP 307 Temporary Redirect status code is useful for maintaining the original request method during a temporary redirection. It ensures that clients perform the same method (e.g., POST) at the new location.

I am the founder of SEO Leaders and have been involved in the internet and web development in one way or another for over 20 years. Since founding SEO Leaders some 6 years ago I have been heavily involved in web develepment, Digital PR and technical SEO for a wide variety of projects. I hope to enlighten you on a wide range of topics related to my chosen profession!

Back To Top