Salutations all.
I’m trying to see if I can get functionality similar to Hiawatha with an easier setup with Caddy. I’ve run into two roadblocks at the moment though, and I’m not sure if I’m missing a feature / misunderstanding the settings or if Caddy simply cannot do it.
The first thing, since I imagine it’s simpler, is redirection. Using Hiawatha, I had a redirect that would pull you to a portal site if you typed in an improper address. Basically, I had it all setup so it was www.example.com, site1.example.com, site2.example.com, etc. If you accidentily typed in stie2.example com ( so you misspelled the subdomain but the domain was the same ) you would get redirected automatically to www, which then provides a map for you to get where you want to go. Caddy does this just fine for http:
http://*.example.com {
redir 301 {
/ https://www.example.com
}
}
Any website not explicitly defined gets redirected to www. So stie2 goes to www but site2 would go to site2. Perfect. Almost. If you type in https://stie2.example.com though, you wind up with a certificate error and Caddy responding with No such site at :443
Is there a way to make Caddy respond similarly in both cases?
The second thing. I’m having issues with timeouts / proxies. I looked through the doc files but I don’t see an option to apply a timeout setting only to a proxy. The timeouts
directive appears to be server wide. If I go with the defaults and, for example, reverse proxy a RocketChat instance, the instance works okay but ever 10 seconds the page reloads because the websocket is reset. Change the timeout setting, and it resets whenever you set the timeout to. For now I have timeouts none
which works ( specifically atm for RocketChat and Wetty ) but it’d be nice if there was a better / more secure way to go about this. In Hiawatha I would specify long timeouts on the reverse proxy connection itself, but I don’t see a way to do this in Caddy based on the docs.
Examples - Hiawatha ( long proxy timeout only )
VirtualHost {
Hostname = chat.example.com
WebSocket = ws://192.168.0.51:3000 /sockjs/(.*)/websocket 3600
ReverseProxy .* http://192.168.0.51:3000 3600
WebsiteRoot = /srv/empty
RequireTLS = yes
}
Examples - Caddy ( timeouts none )
https://chat.example.com {
proxy / 192.168.0.51:3000 {
transparent
websocket
}
root /etc/caddy/blank
timeouts none
}
Thanks in advance for any help.