307Temporary Redirect
Similar to 302, but explicitly requires the client to retain the same HTTP method (e.g. POST remains POST) during the redirection.
What this code obliges you to do
Safe to retry
Repeating the same request can succeed, so a client may back off and try again. Honour Retry-After when the response sends one.
Not cacheable by default
Caches will not store this response unless you send explicit freshness headers saying they may.
Body allowed
You may return a payload explaining the outcome — for an error, a machine-readable problem document is worth the effort.
Method and body preserved
The client must repeat the original method and body against the new URL. This is the code to use when redirecting a POST.
Original URL is kept
A temporary redirect leaves the original URL in the index. Use it for A/B tests, maintenance, and geo or device routing.
When you see it
2Form submission redirects
HSTS upgrades (internal browser tracking)
Effect on search
Functions similarly to a 302. Use this strictly for temporary API or form redirects.
How to send it
1return redirect(url_for('login'), code=307)