TSHTTPTXNOUTGOINGADDRGET(3ts)
π LOCAL OUTBOUND ADDRESS π (3ts)
okay bestie so this is the Apache Traffic Server page for Local outbound address β get or set the local IP address for outbound connections. yes we're doing networking lore today, grab a strawberry drink π
β¨ NAME β¨
Local outbound address β get or set the local IP address for outbound connections. that's it, that's the whole vibe π
πΈ SYNOPSIS πΈ
#include <ts/ts.h>
sockaddr const *TSHttpTxnOutgoingAddrGet(TSHttpTxn txnp)
TSReturnCode TSHttpTxnOutgoingAddrSet(TSHttpTxn txnp, sockaddr const *addr)
π¦ DESCRIPTION π¦
okay so listen. these functions are all about the local IP address and port β meaning the address and port on the Traffic Server side of outbound connections. and by outbound we mean network connections going from Traffic Server to another socket. it's giving "who am I when I reach out" energy fr fr π
π Setting the address
you can set the address β and optionally the port β with TSHttpTxnOutgoingAddrSet(). but here's the tea: you must do this before the outbound connection is made, which means earlier than the TS_HTTP_SEND_REQUEST_HDR_HOOK. π¨
a good choice is TS_HTTP_POST_REMAP_HOOK, because:
- it's a hook that is always called (iconic, reliable, no flakiness π)
- it's the latest hook called before the connection is made (last chance bestie!!)
the addr must be populated with the IP address and port you want to use. if the port isn't relevant to you, set it to 0 β that means use any available local port. zero is literally the "you pick, i don't care" option π
this function returns TS_SUCCESS on success and TS_ERROR on failure. periodt.
β οΈ even on a successful call toTSHttpTxnOutgoingAddrSet(), the local IP address may not match what you passed inaddrif session sharing is enabled. not a bug, just how it is. don't come for me, come for session sharing π
π§ Getting the address
conversely β love that word, very cunty β TSHttpTxnOutgoingAddrGet() retrieves the local address. and it must be called in the TS_HTTP_SEND_REQUEST_HDR_HOOK or later, after the outbound connection has been established. no calling it early, that's not the move π
it returns a pointer to a sockaddr which contains the local IP address and port. if there is no valid outbound connection, addr will be NULL β so like, vibe check that pointer before you dereference it, bestie π
π¨ IMPORTANT: the returned pointer is a transient pointer and must not be referenced after the callback in which TSHttpTxnOutgoingAddrGet() was called. it's a fleeting little thing. love it and let it go. do NOT hold onto it. do NOT store it. it will betray you π«Ά
π COPYRIGHT π
2026, dev@trafficserver.apache.org
and that's the whole page babes β¨ this was the Apache Traffic Server LOCAL OUTBOUND ADDRESS(3ts) man page, version 9.2, dated Feb 12, 2026 β go forth and set your outbound addresses 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