TSREMAPINIT(3ts)
π 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 optionalTSRemapDone()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 passingTSREMAP_CONFIG_RELOAD_FAILUREin case of failure. And it notifies plugins whether they're going to be part of the new configuration by passingTSREMAP_CONFIG_RELOAD_SUCCESS_PLUGIN_USEDorTSREMAP_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_REMAPorTSREMAP_DID_REMAP_STOP. - Otherwise it should return
TSREMAP_NO_REMAPorTSREMAP_NO_REMAP_STOP. - If Traffic Server should not send the transaction to subsequent plugins in the remap chain, return
TSREMAP_NO_REMAP_STOPorTSREMAP_DID_REMAP_STOP. - Returning
TSREMAP_ERRORcauses Traffic Server to stop evaluating the remap chain and respond with an error. π₯
π¦ SEE ALSO π¦
π COPYRIGHT π
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
- 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