TSHTTPTXNINTERCEPT(3ts)
π TSHTTPTXNINTERCEPT π
ok so bestie, welcome to TSHTTPTXNINTERCEPT from the 3ts manuals (that's the Apache Traffic Server plugin API corner of the world, iykyk β¨). This one lets a plugin straight-up take over the servicing of the request, like it is the origin server. main character energy fr fr π
β¨ NAME β¨
TSHttpTxnIntercept β lets a plugin take over the servicing of the request as though it was the origin server π«Ά
πΈ SYNOPSIS πΈ
#include <ts/ts.h>
void TSHttpTxnIntercept(TSCont contp, TSHttpTxn txnp)
π¦ DESCRIPTION π¦
ok so here's the tea β β contp is gonna get sent a TS_EVENT_NET_ACCEPT. The edata that comes along with that TS_EVENT_NET_ACCEPT is a TSVConn, literally just like it would be for a normal accept. no cap.
And then? The plugin has to act like it's an HTTP server. like, fully commit to the bit π
It must read the HTTP request and body off the TSVConn, and then send an HTTP response header and body. that's the whole vibe.
π¨ okay real talk, this next part matters SO much π¨
TSHttpTxnIntercept() must be called from only TS_HTTP_READ_REQUEST_HDR_HOOK. Like, only only. That's the hook, that's the spot, periodt.
Using TSHttpTxnIntercept will bypass the Traffic Server cache. yes, the whole cache, gone, skipped, not invited to the party π
So if the response sent by the plugin should be cached? Use TSHttpTxnServerIntercept() instead. that's the one for that job π
And the primary use of TSHttpTxnIntercept() is to allow plugins to serve data about their functioning directly. cute, right? πΈ
π one more thing bestie β TSHttpTxnIntercept() must only be called once per transaction. once. one time. don't be greedy, the transaction said no thank you π
π COPYRIGHT π
2026, dev@trafficserver.apache.org
and that's the whole page, bestie!! π§β¨ this was 9.2, dated Feb 12, 2026, from the TSHTTPTXNINTERCEPT(3ts) manual β go forth and intercept responsibly, mwah π
π¦ where this page comes from
- ubuntu noble: trafficserver-dev 9.2.3+ds-1+deb12u1ubuntu0.1 Β· Apache-2.0
- ubuntu questing: trafficserver-dev 9.2.5+ds-1ubuntu2.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms