TSHTTPTXNS...RINTERCEPT(3ts)
β¨ NAME β¨
TSHttpTxnServerIntercept β bestie, you get to intercept origin server requests π
πΈ SYNOPSIS πΈ
#include <ts/ts.h>
void TSHttpTxnServerIntercept(TSCont contp, TSHttpTxn txnp)
π DESCRIPTION π
okay so TSHttpTxnServerIntercept() is lowkey iconic β it lets a plugin straight up take over the servicing of the request, like it is the origin server. main character energy fr fr. π
here's the vibe: if a request needs to be made to the server for transaction txnp, then contp gets sent a TS_EVENT_NET_ACCEPT event. the edata that comes with TS_EVENT_NET_ACCEPT is a TSVConn, exactly like it would be for a normal accept. and then your plugin has to act like it's an HTTP server β meaning you read the HTTP request and body from the TSVConn, and you send back an HTTP response header and body. that's the whole job. no pressure bestie π«Ά
β οΈTSHttpTxnServerIntercept()must not be called after the connection to the server has already taken place. so the last hook you can call it from isTS_HTTP_READ_CACHE_HDR_HOOK. and if a connection to the server isn't necessary at all, the continuationcontpgets aTS_EVENT_NET_ACCEPT_FAILEDevent instead when the transaction completes. π
the response from the plugin gets cached, subject to the standard and configured HTTP caching rules β so if your plugin does not want the response cached, you gotta use the appropriate HTTP response headers to prevent caching. that's on you, not on ATS. π
the primary purpose of TSHttpTxnServerIntercept() is to let plugins provide gateways to other protocols, or to let one plugin use its own transport for the next hop to the server. and yes, TSHttpTxnServerIntercept() overrides parent cache configuration. it said "i'm the parent now". π
π also,TSHttpTxnServerIntercept()must only be called once per transaction. and the continuationcontpmust have been created with a validTSMutex. no exceptions, no cap.
π¦ SEE ALSO π¦
π COPYRIGHT π
2026, dev@trafficserver.apache.org
k that's the whole page, you're welcome π this was Apache Traffic Server, version 9.2, dated Feb 12, 2026, page TSHTTPTXNS...RINTERCEPT(3ts) β go forth and intercept, bestie, you got this πβ¨π
π¦ 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