fabio
fabio copied to clipboard
Catch all redirect
This patch adds the option to redirect to the same host but maybe on a different path or scheme.
For this $host
can be used on the target URL, e.g.
route add https-redirect / https://$host$path opts "redirect=301"
Hmm, not sure whether this creates a redirect loop.
If we interpret that https-redirect
as only valid for originating http
that should be redirected to https
I think this works. Meaning that https-redirect
will never match an incoming https
request.
Otherwise we could keep the same http-redirect
with the additional $host
pseudo var and restrict on port in the rule something like...
route add http-redirect :80 https://$host$path opts "redirect=301"
Sorry, just looked at the code ... there's not a new option it is just adding the pseudo var. So I think that you would get a redirect loop with a path /
match but shouldn't with a port :80
match.
Something like route add :80/ ...
might be handy. Not sure if that fits well with the current syntax
Agreed a host agnostic match with a port and path is exactly what you would want for this specific use case.
How about https://github.com/fabiolb/fabio/pull/544 instead?