Introduction
The traditional way of implementing redirects in HAProxy configuration file is by using the http-request redirect statement. It is quite OK for a couple of redirect rules. Sometimes, however, you need to install thousands of redirects. This may be necessary, for instance, when switching to a new version of a site, in order to preserve links to old locations. Keeping such a big number of redirect statements in the configuration file is impractical, and maintaining such a configuration is tedious and error-prone task.
The haproxy-bulkredirect library is designed for such cases. It reads redirection rules from a plain text file, which is easy to maintain. Internally, the rules are stored in an associative array, which provides for fast lookups.