caddyserver / caddy

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
https://caddyserver.com
Apache License 2.0
58.11k stars 4.03k forks source link

http_redirect module prefer 307 Temporary Redirect #6499

Open robballantyne opened 2 months ago

robballantyne commented 2 months ago

Hello,

I am using the http_redirect module to automatically upgrade HTTP connections to HTTPS on a single port, but as far as I can see there is no way to set headers and I would prefer that the redirect is not cached.

My current solution is to simply modify the built-in response code to 307 Temporary Redirect and build with xcaddy, but I was hoping you'd be open to either making 307 the default, or keeping the current default with an option to either add custom headers or specify the redirect code as with a normal redirect.

If there is a better way to approach this I would be really grateful if you could point me in the right direction - And thank you for your work on Caddy, I switched from NGINX and haven't looked back

Cheers!

francislavoie commented 2 months ago

Yeah we can add an option for that :+1: PR welcome if you want to take a shot at it.

robballantyne commented 2 months ago

Thanks - I'm not a Go dev, so not really sure what I am doing but I'll give it a try