-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix: prevent error handler from overriding sub handler matchers #6999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: prevent error handler from overriding sub handler matchers #6999
Conversation
Thanks! Is this really the correct fix though? I imagine there's a JSON structure we can generate that isn't this deep that does it correctly, but I'm not super familiar with the issue right now to know what that would be. |
I tried to have something that is similar to what the normal routes already have as per documentation so I see it as something like this: (Not a real example) @status_404 {
status 404
}
handle @status_404 {
handle /en/* { ... }
handle /es/* { ... }
} so the above code if we use Method matcher or any other matcher, it will result in the same depth as what this PR introduced |
To summarize the issue, it is mainly due to the following line: caddy/caddyconfig/httpcaddyfile/builtins.go Lines 850 to 852 in 9f71483
It was overriding the
correct case:
But if you have sub-routes inside the default
|
Hi, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good -- thank you for working on this. We'll give it a shot!
Fixes: #6957
It make sure that all routes within the handle_errors are within a subroute.