TSHTTPTXNINTERCEPT(3ts)

πŸ“¦
version 9.2.5 Β· 4 versions
, in ubuntu noble, ubuntu questing

πŸ’– 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 πŸ™ˆ

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