TSREMAPINIT(3ts)

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

πŸŽ€ NAME πŸŽ€

TSRemapInit β€” the remap plugin entry points for Apache Traffic Server, bestie πŸ’–

This is the 3ts manual page, and it's lowkey the master doc for every remap plugin you're ever gonna write. Periodt.


✨ SYNOPSIS ✨

#include <ts/ts.h>
#include <ts/remap.h>

TSReturnCode TSRemapInit(TSRemapInterface *api_info, char *errbuff, int
errbuff_size)

void TSRemapPreConfigReload(void)

void TSRemapPostConfigReload(TSReturnCode reloadStatus)

void TSRemapDone(void)

TSRemapStatus TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo
*rri)

TSReturnCode TSRemapNewInstance(int argc, char *argv[], void **ih, char
*errbuff, int errbuff_size)

void TSRemapDeleteInstance(void*)

void TSRemapOSResponse(void *ih, TSHttpTxn rh, int os_response_type)

Slay. That's your whole plugin API right there, no cap. πŸ’…


πŸ’– DESCRIPTION πŸ’–

Okay so the Traffic Server remap interface? It's literally a simplified mechanism for plugins to mess with HTTP transactions. And here's the tea: a remap plugin is not global. It gets configured on a per-remap rule basis, which means you can customize exactly how URLs get redirected based on the individual rules living in remap.config. Obsessed.

So writing a remap plugin = implementing one or more of the remap entry points + configuring remap.config to route the transaction through your plugin. And it gets even better: you can specify multiple remap plugins for a single remap rule, which gives you a remap plugin chain where every single plugin gets its moment to examine the HTTP transaction. Main character energy for everyone. πŸ‘‘

  • TSRemapInit() β€” this one is a required entry point, no skips allowed. Traffic Server calls it once when it loads the plugin. And if you've got the optional TSRemapDone() entry point hanging around, Traffic Server will call that when it unloads the remap plugin. πŸ¦‹
  • A remap plugin may be invoked for different remap rules. Traffic Server calls the entry point every time a plugin is specified in a remap rule. And when a remap plugin instance is no longer required, Traffic Server calls TSRemapDeleteInstance(). At that point it's safe to remove any data or continuations associated with that instance. Cleanup era. 🧹
  • TSRemapDoRemap() β€” called for each HTTP transaction. This one is mandatory. In here, your remap plugin may examine and modify the HTTP transaction. That's the whole point, bestie.
  • TSRemapPreConfigReload() β€” called before the parsing of a new remap configuration starts, so plugins get a heads-up that a configuration reload is coming. It's called on all already loaded plugins, invoked by the current and all previous still-used configurations. This one is optional.
  • TSRemapPostConfigReload() β€” called to signal the end of the new remap configuration load. It's called on the newly and previously loaded plugins, invoked by the new, current and previous still-used configurations. It also tells you whether the configuration reload was successful, by passing TSREMAP_CONFIG_RELOAD_FAILURE in case of failure. And it notifies plugins whether they're going to be part of the new configuration by passing TSREMAP_CONFIG_RELOAD_SUCCESS_PLUGIN_USED or TSREMAP_CONFIG_RELOAD_SUCCESS_PLUGIN_UNUSED. Also optional. 🫢
Generally speaking, calls to these functions are mutually exclusive. The exception is for functions which take an HTTP transaction as a parameter β€” calls to those transaction-specific functions for different transactions are not necessarily mutually exclusive of each other. iykyk. πŸ’€

For further info, go read Remap Plugins.


🌈 TYPES 🌈

enum TSRemapStatus

Status return value for remap callback. The vibe check for your remap function, basically.

  • TSREMAP_DID_REMAP β€” the remap callback modified the request. βœ…
  • TSREMAP_DID_REMAP_STOP β€” the remap callback modified the request and no more remapping callbacks should be invoked.
  • TSREMAP_NO_REMAP β€” the remap callback did not modify the request. πŸ™ˆ
  • TSREMAP_NO_REMAP_STOP β€” the remap callback did not modify the request and no further remapping callbacks should be invoked.
  • TSREMAP_ERROR β€” the remapping attempt in general failed and the transaction should fail with an error return to the user agent. 😭

enum TSRemapReloadStatus

  • TSREMAP_CONFIG_RELOAD_FAILURE β€” notify the plugin that configuration parsing failed. πŸ’€
  • TSREMAP_CONFIG_RELOAD_SUCCESS_PLUGIN_USED β€” configuration parsing succeeded and the plugin was used by the new configuration. πŸ”₯
  • TSREMAP_CONFIG_RELOAD_SUCCESS_PLUGIN_UNUSED β€” configuration parsing succeeded but the plugin was NOT used by the new configuration. Oop.

⭐ RETURN VALUES ⭐

TSRemapInit() and TSRemapNewInstance() should return TS_SUCCESS on success, and TS_ERROR otherwise.

Heads up bestie: a return value of TS_ERROR is unrecoverable. Not a vibe. 🚨

TSRemapDoRemap() returns a status code that says whether the HTTP transaction has been modified, and whether Traffic Server should keep evaluating the chain of remap plugins.

  • If the transaction was modified, your plugin should return TSREMAP_DID_REMAP or TSREMAP_DID_REMAP_STOP.
  • Otherwise it should return TSREMAP_NO_REMAP or TSREMAP_NO_REMAP_STOP.
  • If Traffic Server should not send the transaction to subsequent plugins in the remap chain, return TSREMAP_NO_REMAP_STOP or TSREMAP_DID_REMAP_STOP.
  • Returning TSREMAP_ERROR causes Traffic Server to stop evaluating the remap chain and respond with an error. πŸ”₯

πŸ¦‹ SEE ALSO πŸ¦‹


2026, dev@trafficserver.apache.org


Okay that's the whole page, bestie! πŸ’–βœ¨ This was Apache Traffic Server version 9.2, dated Feb 12, 2026, and it ate, fr fr. Go write an iconic remap plugin. πŸŽ€πŸ«ΆπŸ’…

πŸ“¦ where this page comes from