Bug 39806 - Add env vars to mod_proxy_balancer to allow more control
Summary: Add env vars to mod_proxy_balancer to allow more control
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy_balancer (show other bugs)
Version: 2.2.2
Hardware: Other other
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2006-06-13 21:31 UTC by Brian
Modified: 2006-06-26 10:09 UTC (History)
0 users



Attachments
patch (1.58 KB, patch)
2006-06-13 21:33 UTC, Brian
Details | Diff
mod_proxy_balancer-trunk.patch (3.57 KB, patch)
2006-06-14 19:14 UTC, Brian
Details | Diff
mod_proxy_balancer-trunk.patch (3.58 KB, patch)
2006-06-14 19:16 UTC, Brian
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brian 2006-06-13 21:31:42 UTC
Hello,

Here is a very simple patch to add some env vars to mod_proxy_balancer.  This
allows you to figure out where the request was routed from the reverse proxy.  I
needed this to add sticky session cookies to the response because I could not
modify the backend app.

So, you can do something like this on the reverse proxy:

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
Comment 1 Brian 2006-06-13 21:33:19 UTC
Created attachment 18457 [details]
patch

quick patch to add env vars to mod_proxy_balancer
Comment 2 Jeff Trawick 2006-06-14 12:51:21 UTC
Nice tool.

If you want to log this, use %{BALANCER_foo}e in the access log.  I don't see
the need for the debug-level error log messages.  Other opinions from the crowd?
Comment 3 Brian 2006-06-14 19:14:22 UTC
Created attachment 18467 [details]
mod_proxy_balancer-trunk.patch

Cleaned up patch, added patch to docs, against trunk.
Comment 4 Brian 2006-06-14 19:16:43 UTC
Created attachment 18468 [details]
mod_proxy_balancer-trunk.patch

Let's try that again w/o the tab characters ;)
Comment 5 Brian 2006-06-14 19:19:34 UTC
ok, removed the debug stuff (not needed).  I also went against trunk and added a
patch to the docs as well.
Comment 6 Ruediger Pluem 2006-06-26 17:09:06 UTC
Committed to trunk as r417238
(http://svn.apache.org/viewvc?rev=417238&view=rev). Thanks.