You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "juanthropic (via GitHub)" <gi...@apache.org> on 2026/07/24 22:44:53 UTC
[PR] header_rewrite: add POST_REMAP_HOOK support [trafficserver]
juanthropic opened a new pull request, #13426:
URL: https://github.com/apache/trafficserver/pull/13426
header_rewrite could attach rulesets to most transaction hooks, but not
the real post-remap hook. That left a gap for the global-plugin model:
loaded from plugin.config, it had no hook in the window after remapping
but before the origin request, so rules could not act on the remapped
request the way a per-remap rule can via REMAP_PSEUDO_HOOK.
This adds a POST_REMAP_HOOK hook condition and wires it end to end:
- Recognize the `POST_REMAP_HOOK` keyword in the parser.
- Handle the POST_REMAP event so rulesets run at that hook.
- Gather the post-remap request headers for the hook.
- Allow operators and conditions on the hook by default.
Available to both global (plugin.config) and per-remap configurations.
Covered by a parser unit test and an end-to-end autest that sets a header
at POST_REMAP_HOOK and verifies it on the request forwarded to origin.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] header_rewrite: add POST_REMAP_HOOK support [trafficserver]
Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on PR #13426:
URL: https://github.com/apache/trafficserver/pull/13426#issuecomment-5181571942
Picking up the initialize() override fix here:
https://github.com/apache/trafficserver/pull/13486
Thank you @juanthropic for working on this!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] header_rewrite: add POST_REMAP_HOOK support [trafficserver]
Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit commented on PR #13426:
URL: https://github.com/apache/trafficserver/pull/13426#issuecomment-5173881552
I don't see reasons to have separate lists for those operators. The one I added is just a copy-paste of the other one. Those lists should be removed but the removal is unrelated to this change. I'd make another PR for it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] header_rewrite: add POST_REMAP_HOOK support [trafficserver]
Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt merged PR #13426:
URL: https://github.com/apache/trafficserver/pull/13426
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] header_rewrite: add POST_REMAP_HOOK support [trafficserver]
Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on PR #13426:
URL: https://github.com/apache/trafficserver/pull/13426#issuecomment-5174181089
I agree that removing these redundant overrides would be a useful separate cleanup. My concern does not require that cleanup in this PR, though.
`initialize_hooks()` is virtual, so when `Statement::initialize()` invokes it for `OperatorSetPluginCntl` or one of the state operators, C++ calls the derived override instead of `Statement::initialize_hooks()`. The new POST_REMAP entry in the base implementation therefore has no effect on those operators.
For example, this currently fails configuration parsing:
```text
cond %{POST_REMAP_HOOK}
set-state-flag 0 true
```
`RuleSet::add_operator()` rejects it because `OperatorSetStateFlag::_allowed_hooks` does not contain `TS_HTTP_POST_REMAP_HOOK`. The session operators are affected too because the factory implements them using the same state classes.
The existing AuTest does not expose this because `set-header` inherits the base hook list.
If removing the overrides is out of scope, that is fine. The minimal fix here is to add `TS_HTTP_POST_REMAP_HOOK` to the four overrides marked "allowed everywhere": `OperatorSetPluginCntl`, `OperatorSetStateFlag`, `OperatorSetStateInt8`, and `OperatorSetStateInt16`. Adding `set-state-flag 0 true` to the existing POST_REMAP test ruleset would cover the parsing path.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] header_rewrite: add POST_REMAP_HOOK support [trafficserver]
Posted by "juanthropic (via GitHub)" <gi...@apache.org>.
juanthropic commented on PR #13426:
URL: https://github.com/apache/trafficserver/pull/13426#issuecomment-5124217180
Thanks for the review @bneradt!
> Could these overrides add TS_HTTP_POST_REMAP_HOOK (or delegate to Statement::initialize_hooks())
Yeah definitely one or the other. The comment does say "should be allowed everywhere", so I wonder why the list repeats the base instead of delegating to `Statement::initialize_hooks()`. Perhaps @zwoop or @maskit could comment on whether it makes sense to remove the redundant override and rely on the base.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] header_rewrite: add POST_REMAP_HOOK support [trafficserver]
Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on PR #13426:
URL: https://github.com/apache/trafficserver/pull/13426#issuecomment-5196007403
Cherry-picked to the 10.2.x branch as 6c874f29a971326c157c8f0fa7b887b423aaa997 for the 10.2.0 release.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] header_rewrite: add POST_REMAP_HOOK support [trafficserver]
Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on PR #13426:
URL: https://github.com/apache/trafficserver/pull/13426#issuecomment-5110559675
Adding TS_HTTP_POST_REMAP_HOOK only to Statement::initialize_hooks() does not affect derived operators that override initialize_hooks(). In particular, OperatorSetPluginCntl and OperatorSetStateFlag/Int8/Int16 each say they should be allowed everywhere, but their explicit hook lists omit the new hook. The session-state operators reuse those state classes, so they are affected too.
As a result, a POST_REMAP_HOOK ruleset using set-plugin-cntl, set-state-*, or set-session-* is rejected during configuration parsing. Could these overrides add TS_HTTP_POST_REMAP_HOOK (or delegate to Statement::initialize_hooks()), with a configuration-level test covering one of these operators?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org