1. Caddy version (caddy version
):
v2.4.4 h1:QBsN1jXEsCqRpKPBb8ebVnBNgPxwL50HINWWTuZ7evU=
2. How I run Caddy:
a. System environment:
Custom docker image built off of https://github.com/AviiNL/SirTunnel
d. My complete Caddyfile or JSON config:
{
"apps": {
"http": {
"servers": {
"sirtunnel": {
"listen": [":443"],
"routes": [
]
}
}
}
}
}
3. The problem I’m having:
Everything is running fine, I just have a question to make it even better;
I’m setting up Caddy as an automated reverse proxy with the aid of ssh tunneling, which is working great so far. The only “issue” I currently have, that when I register a route, but the process that actually serves the project is offline (either temporary or permanently) the 502 Caddy gives back is rather ugly.
I was wonder if it’s possible to add a fallback handler to routes that are unreachable by Caddy to present the user with something more clear than a 502 generated by the browser.
The logic I use to register the tunnel can be found here https://github.com/AviiNL/SirTunnel/blob/master/sirtunnel.py#L52
This runs whenever a new ssh tunnel is created.
I was trying to simply add another object in the "handle"
array, to server a static response with “This tunnel is currently unavailable”, but apparently it’s not that simple or I’m missing something
I did find this https://caddy.community/t/how-to-have-a-reverse-proxy-fallback/13421
But I’m not really sure how to apply this in my situation, like how do I add this to the API request, or my (very empty) json config or otherwise?