Oh wow, that’s fascinating. I see what’s going on now. Adapting the configs to JSON with caddy adapt --pretty
makes it obvious. Thanks for noticing that.
So when you have a host matcher, the error routes also inherit the host matcher, on a subroute that wraps the other routes. This subroute has terminal
marked on it which means that once matched, no handlers are executed past that point. The implicit error handler from the above PR isn’t actually run because it’s appended after the subroute, which is “too late”.
I’ll look to make a patch to fix this, I think we can append the implicit error handler at the end of top-level subroutes maybe.