-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
caddyconfig: Add new handle_path directive for easier subpath grouping
#3281
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
caddyconfig: Add new handle_path directive for easier subpath grouping
#3281
Conversation
handle_path directive for easier subpath grouping
58d6130 to
a731cf3
Compare
| // the ParseSegmentAsSubroute function expects the cursor | ||
| // to be at the token just before the block opening, | ||
| // so we need to rewind because we already read past it | ||
| h.Reset() | ||
| h.Next() |
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.
This is a bit funky, but aside from changing how ParseSegmentAsSubroute works to avoid the extra h.Next(), I'm not sure what to do.
handle_path directive for easier subpath groupinghandle_path directive for easier subpath grouping
|
This is super cool, thanks! My only concern is that I actually find the name I don't have an amazing understanding of all the directives so perhaps this wouldn't make sense, but how about splitting up this functionality into two options which could be added to the existing
Then, the functionality of Alternatively, maybe it would be cleaner to add the |
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.
Thanks again @francislavoie -- I like where this is going. I left a few comments about how we handle and what we should expect of the matcher token.
|
@zakcutner I propose we update this PR to accept a first argument that looks and acts like a standard path matcher token, i.e. |
|
I agree with that - I'll try to finish this one off soon. |
|
Sound good 😃 It looks like this will solve a pretty specific use case so I agree there's not much point generalising it further like I was suggesting, particularly as it seems like that would be a lot of work. Thanks again to both of you for all your work on this! |
a731cf3 to
2c77d66
Compare
|
Alright, cleaned this up. I think this is done? |
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.
Great, this LGTM!
@zakcutner can you try this out? And then we will merge it if it works for you.
|
Just tried this out and it works great, thank you both 😃 |
|
Nice work on this one @francislavoie |
Implementation of #3266
This is incomplete/non-functional, still has debug prints etc. The general idea is there but it's not working as expected.Edit: Figured it out! Didn't realize I should be using
h.NewRoute()which does the trick.Caddyfile:
JSON: