TSHTTPTXNS...RINTERCEPT(3ts)

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

✨ 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 is TS_HTTP_READ_CACHE_HDR_HOOK. and if a connection to the server isn't necessary at all, the continuation contp gets a TS_EVENT_NET_ACCEPT_FAILED event 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 continuation contp must have been created with a valid TSMutex. no exceptions, no cap.

πŸ¦‹ SEE ALSO πŸ¦‹


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