User:YuviPanda/Dynamicproxy URL routing
The dynamicproxy puppet module supports a url based proxying mode, that can be enabled by setting luahandler => 'urlproxy.lua'
Redis format
You can add routes to it by directly modifying entries in Redis. For security reasons redis should not be reachable over the network, and you should run a local deamon on the proxy machine to write rules to Redis.
The routing is based on a 'prefix'. It refers to the first part of the URL path that is being requested. For a URL such as /toolname/test1, the prefix is /toolname. You would have an entry in Redis with the prefix as the key and the value being a hashtable that contains the routes for that particular prefix.
For example, assume we want the following routing:
- /toolname/phpthing -> tools-exec-05:3313
- /toolname/gothing -> tools-exec-03:3198
- /toolname/nodething -> tools-exec-01:5532
The redis structure for this routing would be:
Key: '/toolname'
Value: Redis HashTable, with the following entries:
- /phpthing.* -> http://tools-exec-05:3313
- /gothing.* -> http://tools-exec-03:3198
- /nodething.* -> http://tools-exec-01:5532
Notes:
- the prefix needs to be a plain string that starts with a /.
- The individual routes in the hashtable have keys that are PCREs.
- The protocol reference in the value in the hashtable is required.