plugin/rewrite: pre-compile CNAME rewrite regexp#7697
Conversation
2b3c35d to
cf3803b
Compare
This commit changes the CNAME rewrite rule to use a pre-compiled regexp when the match type is RegexMatch instead of compiling it on-the-fly for each request. This will also allow for invalid regexp patterns to be identified during setup instead of causing a panic when the rule is first invoked. Signed-off-by: Charlie Vieth <charlie.vieth@gmail.com>
cf3803b to
6db9f00
Compare
|
@charlievieth , pretty straightforward. Please recheck commit message, i.e. |
|
@charlievieth , out of curiosity, what prompted this PR? |
|
@johnbelamaric , check out @charlievieth on LinkedIn. Perhaps you could help him with an introduction. He is 👐 to 🧑🏭 and could be a good fit for G. |
Nothing production related, I was simply doing a code review of some of the plugins and saw that Additionally, I saw that the other rewrite rules pre-compiled their regex's (when needed), which leads me to assume that pre-compilation is the norm (which I believe it should be). |
ty and I am open to work and can be contacted at linkedin.com/in/charlievieth/ or my sign off email in the commit. |
|
@charlievieth , thank you for contributing! |
This commit changes the CNAME rewrite rule to use a pre-compiled regexp when the match type is RegexMatch instead of compiling it on-the-fly for each request. This will also allow for invalid regexp patterns to be identified during setup instead of causing a panic when the rule is first invoked.
1. Why is this pull request needed and what does it do?
This PR will increase the performance of the CNAME rewrite plugin when using a regex match and will allow for invalid regex patterns to be identified during plugin setup instead of causing a panic the first time the rewrite rule is invoked.
2. Which issues (if any) are related?
N/A
3. Which documentation changes (if any) need to be made?
N/A
4. Does this introduce a backward incompatible change or deprecation?
N/A