Why a 307 keeps the method and body
The server should send the temporary URI in the Location header. 307 and 308 were added to HTTP to signal method-preserving redirects without ambiguity, after browsers began turning 301 and 302 POSTs into GETs. MDN describes what follows: the redirected request reuses the original method and request body.
Against 302. RFC 9110 lets a client change a POST into a GET when it follows a 302, for historical reasons. MDN puts the difference plainly: with a 307, the client must keep the method and body unchanged.
Against 303. When the follow-up request should become a GET, for example after a form POST, HTTP uses 303 See Other rather than 307.
307 is not in RFC 9110's list of heuristically cacheable codes, so caches reuse it only when the response carries explicit cache controls.
A 307 can also appear when no server sent one. MDN says the Strict-Transport-Security header tells browsers to upgrade future HTTP requests to that host to HTTPS automatically. RFC 6797 requires the browser to replace http with https for a known HSTS host before it loads the URL. In Chromium's source code, this upgrade is an internal redirect with status 307, so the method is preserved, and the browser labels it 307 Internal Redirect with the reason HSTS.
307 for forms and APIs, and how Google treats it
MDN recommends 307 over 302 when a site has non-GET operations such as form posts or API calls. If you set redirects in Next.js middleware, check which status code each rule returns.
In next.config.js redirects, permanent: false makes Next.js send a 307 and permanent: true sends a 308. Next.js says it uses 307 and 308 instead of 302 and 301 to explicitly preserve the request method. Its redirect() function uses a 307 by default; Server Action form submissions get a 303.
For API routes in Next.js, see the App Router vs Pages Router comparison.
For rankings, the choice changes little. Google's crawlers handle a 307 the same way as a 302. Google Search lists HTTP 307 among the temporary redirect types, next to 302 and 303. For temporary redirects, Google Search shows the source page, not the target, in search results.
The code you pick still matters. Google notes that although it treats 302 and 307 alike, the codes are semantically different. It advises using the semantically correct redirect code so that other clients, such as other search engines, can benefit.
Sources
- RFC 9110: HTTP SemanticsIETF · rfc-editor.org
- 307 Temporary Redirect - HTTP | MDNMozilla (MDN) · developer.mozilla.org
- Redirections in HTTPMDN · developer.mozilla.org
- How HTTP status codes, and network and DNS errors affect Google SearchGoogle · developers.google.com
- Redirects and Google SearchGoogle · developers.google.com
- Strict-Transport-Security header - HTTP | MDNMDN · developer.mozilla.org
- RFC 6797: HTTP Strict Transport Security (HSTS)IETF · rfc-editor.org
- Chromium source: net/url_request/url_request_http_job.ccChromium Project · source.chromium.org
- Chromium source: net/url_request/redirect_util.ccChromium Project · source.chromium.org
- next.config.js: redirectsVercel (Next.js) · nextjs.org
- Functions: redirectVercel (Next.js) · nextjs.org