307 Temporary Redirect는 리소스가 일시적으로 다른 URL에 있으며, 클라이언트가 원래 요청 메서드와 본문을 그대로 유지한 채 새 URL로 재요청해야 함을 뜻합니다. 즉 POST는 POST로, PUT은 PUT으로 다시 보내집니다.
302가 브라우저마다 메서드를 GET으로 바꾸기도 했던 모호함을 없앤 코드로, 임시 이동이면서 메서드 보존이 반드시 필요할 때 사용합니다.
POST /api/submit HTTP/1.1
Host: example.com
Content-Type: application/json
{"value":42}HTTP/1.1 307 Temporary Redirect
Location: https://backup.example.com/api/submit
Content-Length: 0
(client re-sends the SAME POST with its body to the new URL)app.post('/api/submit', (req, res) => {
// keep method + body, just change host temporarily
res.redirect(307, 'https://backup.example.com/api/submit');
});location = /api/submit {
return 307 https://backup.example.com$request_uri;
}