-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
WIP router: implement path rewrite with regex #8462
Conversation
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.
For reviewers: I'm still trying to figure out why the prefix ends up being wrong once it hits the PrefixPathRewriter.rewrite function. Any help would be greatly appreciated.
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, some API and structural comments. Is this PR still WiP? If so, please reflect in the title.
/wait
source/common/router/config_impl.h
Outdated
bool case_sensitive) const { | ||
ASSERT(case_sensitive ? absl::StartsWith(path, matched_path) | ||
: absl::StartsWithIgnoreCase(path, matched_path)); | ||
return std::regex_replace(matched_path, pattern_, substitution_); |
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.
We don't allow std::regex
to be used going forward, see #7878.
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.
It it enough to be passing in a type of RE2 or is std::regex_replace itself part of the problem?
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.
Yes, please no std::regex of any kind on the data path.
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
@htuch I believe the only remaining error failure is
This ASSERT has a comment that I'm wondering about here. Do you think this is a signal that it should be revisited as to whether this ASSERT is necessary or does it indicate something wrong within the current PR? |
@cmluciano are you clearing the route cache as the comment indicates? You need to do this if you modify path (or any header). |
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.
I think we're still waiting for the switch of the pattern match to be based on RegexMatcher
and RE2.
/wait
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Not stale- I had some temporary compilation problems and now I'm working through basing this off of the RE2 library |
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Can we re-open this please? |
@vikpck reopened, but not would be good to hear from @cmluciano on the plan. I've heard at least 2 folks in the past week in various conversations ask for this :) |
Thanks for re-opening. I'll be getting back to working on this today. |
Co-Authored-By: Gabriel Taylor Russ <gabriel.taylor.russ@gmail.com> Signed-off-by: Christopher M. Luciano <cmluciano@us.ibm.com>
Signed-off-by: Christopher M. Luciano <cmluciano@us.ibm.com>
Signed-off-by: Christopher M. Luciano <cmluciano@us.ibm.com>
Signed-off-by: Christopher M. Luciano <cmluciano@us.ibm.com>
Signed-off-by: Christopher M. Luciano <cmluciano@us.ibm.com>
56235c1
to
63b28e8
Compare
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
We would really like this functionality as well! Is there an ETA? |
We hope to see some TODOs be implemented soon. Meanwhile, seems like you need to merge master? And this: #8462 (review). Thanks! |
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
No stale according to my exchange with @cmluciano. |
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Not stale |
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
@cmluciano have you been able to make any progress on this? |
I'm not sure who can take it over, but I would recommend using RE2 for regexes for this rather than std::regex. I think going forward we want to use that wherever possible in Envoy due to better performance and predictability. |
Support path rewriting using regular expressions and optionally capture groups. This PR is like #8462, but using the safe regular expression support. Risk Level: Medium, since it slightly modifies the existing `prefix_rewrite` code. Testing: Unit tests are added to `test/common/router/config_impl_test.cc`, runnable with `bazel test //test/common/router:config_impl_test` Docs Changes: Any doc that references `prefix_rewrite` has been changed to reference `regex_rewrite` as well, if appropriate. Release Notes: A bullet is added to `docs/root/intro/version_history.rst` mentioning the new support. Signed-off-by: James Hennessy <jph@us.ibm.com>
Co-Authored-By: Gabriel Taylor Russ gabriel.taylor.russ@gmail.com
Signed-off-by: Christopher M. Luciano cmluciano@us.ibm.com
Description: Support regex path rewrites
Risk Level: Medium, modifies an existing rewrite action
Testing:
bazel test //test/common/router:config_impl_test
Docs Changes: TODO
Release Notes: TODO
Fixes #2092
TODO: