Proxy throughput method of load balancing

New to mod_rewrite? This is a good place to start.

Postby adinarayanak » Mon May 06, 2002 12:11 am

Hi,
We have got two apache webservers running at two diffrent machines.(let's say the urls are http://site1.domain.com:7777 and
http://site2.domain.com:7778 ) I am using another instance of apache webserver on site1.domai.com, running at port 7000.
I want to distribute URL requests between http://site1.domain.com:7777 and http://site2.domain.com:7778 based on the cookie value. I included the following
lines in httpd.conf to enable this load balancing(proxy throughput method)

RewriteEngine on
RewriteLog "/path/to/rewrite.log"
RewriteLogLevel 0
RewriteLock "/path/to/rewrite.lock"

RewriteMap lb prg:/path/to/lb.pl
RewriteRule ^/(.+)$ ${lb:$1:%{HTTP:Cookie}} [P,L]

When I connect to http://site1.domain.com:7000, it gets index page from one of the backend servers and displays it on the browser.
After entering my username and passwd in the index page I click on submit button. The request will go
to http://site1.domain.com:7000 and that will send this request to one of the back end servers. The back end server sets username
and serverid as cookies.

( The back end servers are DEC machines)

Here are the two cases.

1) when I directly connect to one of the backend servers like http://site1.domain.com:7777, supplying username and passwd and click
on submit button
the following two lines are present in the HTTP header ( captured through ethereal)
Set-Cookie: serverid=1.2.3.1
Set-Cookie: username=xxxxx

2) when I connect to one of the backend servers through intermediate instance ( server at 7000) and
capture the HTTP header, the following lines are present
Set-Cookie: serverid=1.2.3.1
X-Cache: MISS from site1.domain.com

Why is this difference ? When I print the cookie value in lb.pl(mentioned in RewriteMap), it displays
serverid=1.2.3.1. The username cookie is missing. What could be the reason ?

Thanx,
Adi
adinarayanak
 
Posts: 1
Joined: Sun May 05, 2002 4:00 pm
Location: India

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 32 guests

cron