TSHTTPTXNSERVERADDRSET(3ts)

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

πŸ’– NAME πŸ’–

TSHttpTxnServerAddrSet β€” the API function TSHttpTxnServerAddrSet, bestie. That's it, that's the name, and it's lowkey iconic.


✨ SYNOPSIS ✨

#include <ts/ts.h>

TSReturnCode TSHttpTxnServerAddrSet(TSHttpTxn txnp, struct sockaddr const *addr)

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so, this one sets the origin server address for the transaction txnp. The port lives inside addr too, so it's a whole package deal β€” and the address family? Also decided by whatever's in addr. No separate flag, no extra drama.

The address data gets copied out of addr, so once you hand it over you do not have to keep that object alive. It's not holding a grudge, it's not holding a pointer, you can let it go. 🫢

⏰ Timing check: this hook must be called no later than TS_HTTP_OS_DNS_HOOK. If you call it prior to TS_HTTP_OS_DNS_HOOK, DNS resolution will not be done, because like… the address of the server is already known. Why would it look it up? It wouldn't. Periodt.

🌸 RETURN VALUE 🌸

TS_ERROR gets returned if addr does not contain a valid IPv4 or IPv6 address with a valid (non-zero) port. So like, give it a real address and an actual port, bestie, not vibes. πŸ’€


πŸŽ€ NOTES πŸŽ€

  • If Traffic Server is configured to retry connections to origin servers and TSHttpTxnServerAddrGet() has been called, Traffic Server will return to TS_HTTP_OS_DNS_HOOK so to let the plugin set a different server address.
  • Plugins should be prepared for TS_HTTP_OS_DNS_HOOK and any subsequent hooks to be called multiple times. Not once. Multiple. Be ready. πŸ™ˆ
  • Once a plugin calls TSHttpTxnServerAddrGet(), any prior DNS resolution results are lost. Gone. Poof. 😭
  • The plugin should use TSHttpTxnServerAddrGet() to preserve any DNS Results that might need.
no cap: that last point is the whole survival strategy. If you care about your DNS results, grab them with TSHttpTxnServerAddrGet() before they get Thanos-snapped. ⭐

πŸ”₯ SEE ALSO πŸ”₯


2026, dev@trafficserver.apache.org


and that's the whole page, bestie πŸ’… this came from the Apache Traffic Server manual, version 9.2, dated Feb 12, 2026 β€” go forth and set those server addresses responsibly, mwah 🧚✨

πŸ“¦ where this page comes from