Temporary Redirect
Tells the client to get the resource at another URI with the same method that was used in the prior request.
What it means
The HTTP 307 Temporary Redirect redirect status response code indicates that the resource requested has been temporarily moved to the URL given by the `Location` headers.
The only difference between 307 and 302 is that 307 guarantees that the method and the body will not be changed when the redirected request is made. If a client sent a POST request, they MUST make a POST request to the new Location.
How it works
- 1The client sends a POST request (e.g. uploading a file) to /upload-v1.
- 2The server responds with '307 Temporary Redirect' to /upload-v2.
- 3The browser automatically makes a POST request to /upload-v2, including the original file data.
Why you're seeing this
- • The server temporarily moved the resource and demands the HTTP method be preserved.
How to fix it
- • Ensure your HTTP client library respects 307s by resending the body payload.
Framework Implementations
Next.js
import { NextResponse } from 'next/server';
export function POST() {
return NextResponse.redirect(new URL('/new-api', request.url), 307);
}Real-Life Scenarios
Use this instead of 302 for API endpoints where you are temporarily shifting traffic but want to ensure the client repeats their POST/PUT/DELETE request exactly as originally formed.
API Endpoint Maintenance
You are migrating a database on the primary server, so you use a 307 to bounce all incoming POST requests to a temporary backup server.
HTTP Transaction
1. Client Request
POST /api/data HTTP/1.1
Host: api.com
{"user": "jane"}2. Server Response
HTTP/1.1 307 Temporary Redirect Location: https://backup.api.com/data
SEO Implications
Search engines treat it similarly to a 302. It does not pass link equity. Use 308 for permanent method-preserving redirects.