Traffic Server remap plugin entry points.


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

TSReturnCode TSRemapInit(TSRemapInterface * api_info, char * errbuf, int errbuf_size)
void TSRemapConfigReload(void)
void TSRemapDone(void)
TSRemapStatus TSRemapDoRemap(void * ih, TSHttpTxn rh, TSRemapRequestInfo * rri)
TSReturnCode TSRemapNewInstance(int argc, char * argv[], void ** ih, char * errbuf, int errbuf_size)
void TSRemapDeleteInstance(void *)
void TSRemapOSResponse(void * ih, TSHttpTxn rh, int os_response_type)


The Traffic Server remap interface provides a simplified mechanism for plugins to manipulate HTTP transactions. A remap plugin is not global; it is configured on a per-remap rule basis, which enables you to customize how URLs are redirected based on individual rules in remap.config. Writing a remap plugin consists of implementing one or more of the remap entry points and configuring remap.config to route the transaction through your plugin. Multiple remap plugins can be specified for a single remap rule, resulting in a remap plugin chain where each plugin is given an opportunity to examine the HTTP transaction.

TSRemapInit() is a required entry point. This function will be called once when Traffic Server loads the plugin. If the optional TSRemapDone() entry point is available, Traffic Server will call then when unloading the remap plugin.

A remap plugin may be invoked for different remap rules. Traffic Server will call the entry point each time a plugin is specified in a remap rule. When a remap plugin instance is no longer required, Traffic Server will call TSRemapDeleteInstance(). At that point, it’s safe to remove any data or continuations associated with that instance.

TSRemapDoRemap() is called for each HTTP transaction. This is a mandatory entry point. In this function, the remap plugin may examine and modify the HTTP transaction.

TSRemapConfigReload() is called once for every remap plugin just before the remap configuration file (remap.config) is reloaded. This is an optional entry point, which takes no arguments and has no return value.

Generally speaking, calls to these functions are mutually exclusive. The exception is for functions which take an HTTP transaction as a parameter. Calls to these transaction-specific functions for different transactions are not necessarily mutually exclusive of each other.



Status return value for remap callback.


The remap callback modified the request.


The remap callback modified the request and that no more remapping callbacks should be invoked.


The remap callback did not modify the request.


The remap callback did not modify the request and that no further remapping callbacks should be invoked.


The remapping attempt in general failed and the transaction should fail with an error return to the user agent.

Return Values

TSRemapInit() and TSRemapNewInstance() should return TS_SUCCESS on success, and TS_ERROR otherwise. A return value of TS_ERROR is unrecoverable.

TSRemapDoRemap() returns a status code that indicates whether the HTTP transaction has been modified and whether Traffic Server should continue to evaluate the chain of remap plugins. If the transaction was modified, the 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