Hi,

I was faced with the problem of letting people choose between using two 
different systems for a tool, an old one and a new one.

For selecting the backend, I ended up using a cookie that I tested with hdr_sub 
to choose the correct backend. It took me a day to think of using the hdr_sub 
so I'd like to request an ACL "cookie(name) value" that you can give a cookie 
name and it will parse it out of the Cookie header for inspection. It would be 
mostly syntactic sugar but it will help people faced with this problem when 
they read the manual.

Secondly, I had to convert the GET scheme into the REST scheme used for the new 
tool. Redirect only allows adding paths to the front of a URL so after much 
trial and error, I used a three-step approach in the backend:
1. Use reqrep to strip the regular path prefix before sending it to the backend 
(e.g. /myapp/ gets changed to /)
2. Use reqrep to replace the non-matching path+query string into the correct 
path to the new tool (e.g. /myoldapp/?foo=3 gets changed to /myapp/3)
3. Use "redirect prefix /" when the prefix is still there (so if the url got 
rewritten, tell the user agent to use that instead and retain the query)

This is a nice trick but it requires stripping the path for each request and 
that needs the http close. If there would be a "redirect strip" which removes a 
prefix, then it could be done instead as:
1. Use reqrep to replace the non-matching path+query string into the correct 
path + prefix (e.g. /myoldapp/?foo=3 gets changed to /redir/myapp/3)
2. Use "redirect strip /redir/" to redirect the UA to /myapp/3.

It would be nice if it would only redirect if the path begins with /redir/ 
without having to specify that, having to type "redirect strip /redir/ if 
{path_beg /redir/}" is a bit redundant. This would also protect against 
redirect loops.

So in summary:
- Please consider adding cookie(name) as an ACL
- Please consider adding strip as a redirect method

Thanks!

Wout.

Reply via email to