The HTTP 307 status code stands for "Temporary Redirect". It is a redirection response indicating that the requested resource has temporarily moved to a different URL, but the client should keep using the original request method (e.g., POST remains POST).

When is HTTP 307 Used?

  • When a resource is temporarily available at a different location, but the original URL should still be used for future requests.
  • Unlike HTTP 302, it ensures that the HTTP method does not change (e.g., a POST request remains a POST after redirection).
  • Often used in load balancing or maintenance mode.

Example Scenarios

  • Temporary Maintenance – A webpage is temporarily moved to another server.
  • Preserving HTTP Method – Ensures that a POST request does not turn into a GET request after redirection.
  • Cloud Load Balancing – Redirects users to another data center while maintaining request integrity.

Example

Client Request (POST to an API Endpoint)

    
        POST /api/data HTTP/1.1
        Host: example.com
    

Server Response (Temporary Redirect, Keep Using POST)

    
        HTTP/1.1 307 Temporary Redirect
        Location: https://new.example.com/api/data
    

Client Automatically Follows Redirect (Using POST, Not GET)

    
        POST /api/data HTTP/1.1
        Host: new.example.com
    

Summary

HTTP 307 means the requested resource is temporarily moved, but the HTTP method must remain unchanged. It is commonly used for temporary maintenance, API redirections, and load balancing.