recollir
(Federico Hernandez)
November 23, 2016, 9:15pm
1
I currently use this a lot
https://www.example.com {
redir https://example.com
tls user@example.com
}
https://example.com {
root /opt/www/example.com
tls user@example.com
}
To simplify the config I would like to introduce a variation of the redir
directive and be able to use `redir from. So the above config would then be
https://.example.com {
redir from https://www.example.com
root /opt/www/example.com
tls user@example.com
}
Caddy would still set up a listener for www.example.com and retrieve a cert. But now implicitly from the config of example.com .
Feasible? Already possible? Worth to submit as an issue to github?
Thanks for Caddy. Great software. Great community.
/F
Caddy definitely needs the domain you want to fetch a certificate for to be at the start of the Caddyfile. However you can try using if statements from the redir directive to create something like this untested example:
example.com, www.example.com {
tls user@example.com
root /opt/www/example.com
redir {
if {host} starts_with www.example.com
/ https://example.com{uri}
}
}
To go the other way, you’d instead use
redir {
if {host} starts_with example.com
/ https://www.example.com{uri}
}
1 Like
recollir
(Federico Hernandez)
November 24, 2016, 12:12pm
3
Thank you, Matthew.
Good idea. Will give it a try.
system
(system)
Closed
February 22, 2017, 12:12pm
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.