Query Remap Plugin

The Remap plugin provides a more flexible, dynamic way of specifying remap rules. It is not built on top of the Traffic Server APIs and exists solely for the purpose of URL remapping. The 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 the remap.config file.

The Traffic Server Remap API enables a plugin to dynamically map a client request to a target URL. Each plugin is associated with one or more remap rules in remap.config (an “instance”). If a request URL matches a remap rule’s “fromURL”, then Traffic Server calls the plugin-defined remap function for that request.

Note

Additional text TBD; text in this chapter is still under development

Remap Header File

The remap.h header file contains the Traffic Server remap API. By default, the header file location is: /usr/local/include/ts/remap.h

Required Functions

A remap plugin is required to implement the following functions:

  • TSRemapInit(): the remap initialization function, called once when the plugin is loaded
  • TSRemapNewInstance(): a new instance is created for each rule associated with the plugin. Called each time the plugin used in a remap rule (this function is what processes the pparam values)
  • TSRemapDoRemap(): the entry point used by Traffic Server to find the new URL to which it remaps; called every time a request comes in

Configuration

To associate a remap plugin with a remap rule, use the @plugin parameter (see Plugin Chaining).