You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "vuori (via GitHub)" <gi...@apache.org> on 2025/09/10 13:34:16 UTC

[I] header_rewrite/10.1.0: matching URL in SEND_REQUEST_HDR_HOOK never matches [trafficserver]

vuori opened a new issue, #12496:
URL: https://github.com/apache/trafficserver/issues/12496

   When attempting to use a header_rewrite config under 10.1.0 that has a `cond` matching on some part of `%{URL}` in `SEND_REQUEST_HDR_HOOK`, the match never returns true. It appears that the plugin is unable to fetch the details of the outgoing request. `%{CLIENT-URL}` works as expected.
   
   This happens both as a global and remap plugin.
   
   Example config where the action never happens:
   
   ```
   cond %{SEND_REQUEST_HDR_HOOK}
   cond %{URL:HOST} /s3-/
   rm-header Range
   ```
   
   Debug output (above config added in `plugin.config`):
   
   ```
   [Sep 10 16:23:03.069] [ET_NET 0] DIAG: <resources.h:48 (Resources)> (dbg_header_rewrite) Calling CTOR for Resources (InkAPI)
   [Sep 10 16:23:03.069] [ET_NET 0] DIAG: <resources.cc:31 (gather)> (header_rewrite) Building resources, hook=TS_HTTP_SEND_REQUEST_HDR_HOOK
   [Sep 10 16:23:03.069] [ET_NET 0] DIAG: <resources.cc:39 (gather)> (header_rewrite) Adding TXN client request header buffers
   [Sep 10 16:23:03.069] [ET_NET 0] DIAG: <resources.cc:63 (gather)> (header_rewrite) Processing TS_HTTP_SEND_REQUEST_HDR_HOOK
   [Sep 10 16:23:03.069] [ET_NET 0] DIAG: <resources.cc:66 (gather)> (header_rewrite) Adding TXN server request header buffers
   [Sep 10 16:23:03.069] [ET_NET 0] DIAG: <resources.cc:68 (gather)> (header_rewrite) could not gather bufp/hdr_loc for request
   [Sep 10 16:23:03.069] [ET_NET 0] DIAG: <conditions.h:733 (eval)> (header_rewrite) Evaluating GROUP()
   [Sep 10 16:23:03.069] [ET_NET 0] DIAG: <conditions.cc:324 (append_value)> (header_rewrite)    Host to match is:
   [Sep 10 16:23:03.069] [ET_NET 0] DIAG: <matcher.h:194 (test_reg)> (header_rewrite) Test regular expression s3- :  (NOCASE = 0)
   ```
   
   The `could not gather bufp/hdr_loc for request` message is caused by `TSHttpTxnServerReqGet` failing in `Resources::gather`. I could not immediately see a reason why this operation fails. I'm pretty sure this worked under 10.0.x.


-- 
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: issues-unsubscribe@trafficserver.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] header_rewrite/10.1.0: matching URL in SEND_REQUEST_HDR_HOOK never matches [trafficserver]

Posted by "bryancall (via GitHub)" <gi...@apache.org>.
bryancall commented on issue #12496:
URL: https://github.com/apache/trafficserver/issues/12496#issuecomment-3294199187

   Closing this issue since the fix was merged


-- 
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: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] header_rewrite/10.1.0: matching URL in SEND_REQUEST_HDR_HOOK never matches [trafficserver]

Posted by "bryancall (via GitHub)" <gi...@apache.org>.
bryancall closed issue #12496: header_rewrite/10.1.0: matching URL in SEND_REQUEST_HDR_HOOK never matches
URL: https://github.com/apache/trafficserver/issues/12496


-- 
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: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] header_rewrite/10.1.0: matching URL in SEND_REQUEST_HDR_HOOK never matches [trafficserver]

Posted by "vuori (via GitHub)" <gi...@apache.org>.
vuori commented on issue #12496:
URL: https://github.com/apache/trafficserver/issues/12496#issuecomment-3281785552

   I looked into this a bit more, and looks like the `could not gather` message is red herring: the comparison should be checking for `!= TS_SUCCESS` (like other conditionals in this function). This should be fixed, otherwise it looks like `_ready` won't become `true`'.
   
   The deeper cause is that `CondtionUrl` is getting an `URLImpl` object that only has path and query. Scheme/host/port are all null. Ultimately I think this `URLImpl` comes from `TSHttpTxnServerReqGet` in `Resources::gather`.
   
   So I guess at this point the `HTTPHdr` object is representing the URI which will be sent to the origin server, which is only the path+query?
   
   This makes the semantics of `%{URL}` rather confusing in the request phase. Since `CLIENT-URL` is the pristine URL, what's the correct way to access the post-remap host in the global context? `%{HEADER:Host}`?


-- 
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: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org