TSHTTPTXNOUTGOINGADDRGET(3ts)

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

πŸ’– 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 to TSHttpTxnOutgoingAddrSet(), the local IP address may not match what you passed in addr if 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 🫢

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