You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unexpected/wrong/undocumented behavior when using regex_remap plugin #2877
According to the documentation defining something like: map http://a.com http://b.com @plugin=regex_remap.so @pparam=maps.reg
will redirect to http://b.com if none if the rules in maps.reg matches.
However, I've seen that if we instead of http://b.com/ writes http://b.com/default the word default gets prepended to the string being matched. I would expect the "fall through url" to be totally ignored before matching has been done.
Sure, it's very simple as I'm just trying to learn ATS. Basically I have ATS running on port 8080 and then I have authentication service running on 8081 and my backend service on 8082
I think it’s because regex_remap plugin use post remapped path to check regex remap rule.
In my environment,
when trafficserver get http request from client,
first, trafficserver execute first remap plugin’s TSRemapDoRemap function. (in the above configuration, authproxy plugin’s TSRemapDoRemap.)
Next, trafficserver execute remap operetaion.
And finally, trafficserver execute regex_remap plugin’s TSRemapDoRemap function.
Debug log of “regex_remap” tag is follow.
I think regex_remap plugin use the post remapped path to check whether the path match with regex remap rule or not.
This issue should have been fixed by PR #4964 which implemented what was agreed on the dev mailing list - email thread "[PROPOSAL] Rewrite url after running all remap plugins" which resulted in a new proposal to "rewrite url before all remap plugins". Please reopen if any problems or concerns!
Activity
mlibbey commentedon Nov 29, 2017
Can you post the content of maps.reg?
wederbrand commentedon Nov 29, 2017
Sure, it's very simple as I'm just trying to learn ATS. Basically I have ATS running on port 8080 and then I have authentication service running on 8081 and my backend service on 8082
in remap.config I have this (and nothing else)
takkitano commentedon Jul 17, 2018
I think it’s because regex_remap plugin use post remapped path to check regex remap rule.
In my environment,
when trafficserver get http request from client,
first, trafficserver execute first remap plugin’s TSRemapDoRemap function. (in the above configuration, authproxy plugin’s TSRemapDoRemap.)
Next, trafficserver execute remap operetaion.
And finally, trafficserver execute regex_remap plugin’s TSRemapDoRemap function.
Then regex_remap plugin get post remapped url in the following lines.
https://github.com/apache/trafficserver/blob/master/plugins/regex_remap/regex_remap.cc#L97-L102
I was faced the same problem.
I use trafficserver-7.1.4.
In following setting, trafficserver should forward the request from “http://before-remap.com/” to “http://after-remap.com/index.html”.
But my trafficserver forward the request from “http://before-remap.com/” to “http://after-remap.com/no-regex/“.
Debug log of “regex_remap” tag is follow.
I think regex_remap plugin use the post remapped path to check whether the path match with regex remap rule or not.
bryancall commentedon May 22, 2019
If this is still an issue please reopen.
gtenev commentedon May 30, 2019
This issue should have been fixed by PR #4964 which implemented what was agreed on the dev mailing list - email thread "[PROPOSAL] Rewrite url after running all remap plugins" which resulted in a new proposal to "rewrite url before all remap plugins". Please reopen if any problems or concerns!