`redir`: using `temporary` issues 302 rather than 307
Issue Details
It's documented that the config redir /target temporary responds with status 302 (Found). However, there's an HTTP status code 307 which "Temporary Redirect" by definition. MDN says the difference is:
The difference between 307 and 302 is that 307 guarantees that the client will not change the request method and body when the redirected request is made. With 302, older clients incorrectly changed the method to GET. 307 and 302 responses are identical when the request method is GET.
I'm not sure if we had a reason for using 302. Should this be changed to 307? Is this change a breaking change?
Found while working on #6255
Assistance Disclosure
AI used
If AI was used, describe the extent to which it was used.
The test case was written by copilot
Prior discussions: https://github.com/caddyserver/caddy/issues/5858 and https://github.com/caddyserver/caddy/issues/6499
I don't remember for sure, but I think I used 302 because 307 didn't exist when I first wrote Caddy, or at least wasn't really standardized/recognized yet. I don't remember for sure.
In any case, from the prior discussions linked above and elsewhere, we know that some people rely on the behavior of 302 versus 307. Usually, but not always, the dividing line is whether it's a browser client or an API client.
Personally, I'm not super interested in changing the named redirect codes at this point, or adding new ones. The number is shorter to type and read, and more clear about what it does...