On 6/8/06, Brian Rectanus <brectanu@xxxxxxxxx> wrote:
On 6/7/06, Nick Kew <nick@xxxxxxxxxxxx> wrote: > On Wednesday 07 June 2006 21:54, Brian Rectanus wrote: > > Does anyone know of a way to retrieve a value from the notes table > > into an ENV var or otherwise use it within an apache conf? > > Notes are per-request. They don't exist outside a request. Yes, I know. I want to use RewriteCond or similar. > > > All I can > > find is docs on how to use it in logs, but not actually base a > > decision on the value or use it in a RewriteRule, etc. > > If there's a good reason to use [something] in your application, > it should be an env var rather than a note in the first place. Yep, I agree. Unfortunatly mod_proxy_balancer does not export it as an env. > > > Specifically, I want to know what route that was used by the balancer > > within a 2.2.2 reverse proxy. This is the 'session-route' note > > assigned within mod_proxy_balancer.c > > You can access that from a module. Yeah, I will probably just have to write a simple module to export it or patch mod_proxy_balancer, but I was hoping there might be another way to avoid a custom solution. I'll probably go the route of patching mod_proxy_balancer to export into env and submitting it for a hopeful upstream inclusion. Thanks, -B
Looks like the notes were only for what the user specified in the balancer sticky session identifier and not what the route taken was. I sent a quick patch upstream to add chosen route env vars to mod_proxy_balancer. http://issues.apache.org/bugzilla/show_bug.cgi?id=39806 This allows for setting up the sticky sessions from the reverse proxy instead of having to add it to the backend app (because sometimes you cannot do that). So, something like this will work: SetEnvIf ^Cookie$ "MYCOOKIE=([^ ;]*)" MYCOOKIE=$1 Header append Set-Cookie "MYCOOKIE=%{UNIQUE_ID}e.%{BALANCER_WORKER_ROUTE}e; path=/" env=!MYCOOKIE RewriteRule ^/+(.*) balancer://test/$1 [P] ProxyPassReverse / balancer://test/ <Proxy balancer://test> BalancerMember http://host1 route=host1 BalancerMember http://host2 route=host2 </Proxy> ProxySet balancer://test stickysession=MYCOOKIE nofailover=On I will probably update that patch when I finalize how I want to do things. Comments? Add them to the bug/enhancement request. Thanks, -B --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx