What is the difference between 302 Found and 307 Temporary Redirect?
302 allows user agents to change POST to GET when following the redirect, whereas 307 strictly preserves the original HTTP method and request body.
HTTP 302 Found indicates a temporary redirect, commonly used for OAuth login flows, A/B routing, and geo-redirects. Unlike 307, browsers historically rewrite POST to GET when following a 302.
location /promo-old {
add_header Cache-Control "no-store" always;
return 302 https://example.com/promo-new;
}
curl -i -sS https://example.com/promo-old
302 allows user agents to change POST to GET when following the redirect, whereas 307 strictly preserves the original HTTP method and request body.
Web frameworks like Rails, Laravel, or Spring Security default to HTML form login redirects. Configure JSON/API routes to return 401 Unauthorized.
Not by default unless you explicitly attach Cache-Control or Expires headers.