Re: How to select the directory index file for load balancing?

Theo Schlossnagle <[email protected]> Wed, 29 Oct 2003 10:13:54 -0500
Newsgroups gmane.comp.apache.mod-backhand.general
Message-ID <[email protected]>
All that magic should happen in the post read request handler.  The 
backhand: is added and removed elsewhere, but the decision about trying 
to balance it is made in post read request.  Good luck.  The Apache 
1.3.x module system is -- to put it nice -- obtuse.

On Oct 29, 2003, at 10:04 AM, Bryan Ross wrote:

> Hi there;
>
> Quick question:
>
> While debugging a slightly different problem, we came across something 
> that
> looked like mod_backhand interfering with sub requests. We just 
> assumed that
> it was trying to handle them. When mod_dir does a 'fake' request to 
> get the
> uri.... Eg:
>
>   request_rec *rr = ap_sub_req_lookup_uri(name_ptr, r); (see my 
> previous
> post)
>
> Why does mod_backhand prepend "backhand:" to the uri? .... Eg:
>
>   char *new_uri = ap_escape_uri(r->pool, rr->uri);
>
> Here, new_uri will equal "backhand: /mydir/file.cgi" - which in our 
> tests,
> has caused 404 errors to be returned.
>
> This is what we were hoping to change. Ie, get mod_backhand not to add 
> the
> "backhand:" when apache is doing an ap_sub_req_lookup_uri. In the 
> meantime,
> we've hacked mod_dir to simply drop the "backhand:", and it seems to 
> work
> okay. We've not looked into changing mod_backhand yet to see how 
> difficult
> it would be, but I'll keep you posted. We're no apache experts, so  any
> advice would be gratefully received!
>
> Cheers
> Bryan
>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of
>> Theo Schlossnagle
>> Sent: Wednesday, October 29, 2003 2:23 PM
>> To: [email protected]
>> Cc: Theo Schlossnagle
>> Subject: Re: [m_b_users] How to select the directory index
>> file for load balancing?
>>
>> I'm just fishin' here... But I think it has to do with the
>> way mod_backhand handles apache internal subrequests.
>>
>> mod_backhand will only try to load balance things that are
>> initial requests.  Here, the initial request is / and then it
>> is expanded with DirectoryIndex to /index.php which is issues
>> into apache as an internal sub request, which mod_backhand
>> will not attempt to load balance.
>>
>> This behaviour was selected to allow mod_backhand to
>> peacefully coexist with modules like mod_gzip.
>>
>> One way is to work around this is to use mod_rewrite.  I
>> think you can rewrite all / to index.php with a 302 and that
>> will work like a charm.
>> If that isn't a desirable approach, then someone more clever
>> than me can try to change mod_backhand to handle subrequests too...
>>
>> On Oct 29, 2003, at 9:08 AM, Thomas Buehren wrote:
>>
>>> Hello again,
>>>
>>> having read the mail of Bryan Ross who also has problems with the
>>> DirectoryIndex, I wonder if my problem of how to load balance the
>>> directory index file might result from a mod_backhand error:
>>>
>>> This works with the directory index file index.php
>> (http://DOMAINNAME/
>>> returns a 403 forbidden):
>>>
>>>  <Directory "/usr/local/httpd/htdocs/genieuk">
>>>    <Files ~ "(\.php3|\.php)$">
>>>     Order allow,deny
>>>     Deny from all
>>>    </Files>
>>>  </Directory>
>>>
>>> So, the Files statement seems to include my index.php
>> directory index
>>> file.
>>> BUT this does not work with index.php
>> (http://DOMAINNAME/index.php is
>>> load balanced, but http://DOMAINNAME/ is always executed on the
>>> original
>>> server):
>>>
>>>  <Directory "/usr/local/httpd/htdocs/genieuk">
>>>    <Files ~ "(\.php3|\.php)$">
>>>      Backhand byAge
>>>      Backhand byRandom
>>>      Backhand byLoad -3.0
>>>    </Files>
>>>  </Directory>
>>>
>>> Does anyone know how to enable load balancing for
>> http://DOMAINNAME/?
>>>
>>> Thomas
>>>
>>>
>>>> -----Original Message-----
>>>> From: [email protected]
>>>> [mailto:[email protected]]On Behalf
>> Of Thomas
>>>> Buehren
>>>> Sent: Sunday, October 26, 2003 1:25 PM
>>>>
>>>> Hello,
>>>>
>>>> probably a simple question for you, but I could not find a
>> solution:
>>>>
>>>> I use backhand to load-balance php requests. All the rest
>> should be
>>>> processed by the original server. The "Files" selection in the
>>>> configuration below does that for me.
>>>>
>>>> The problem: The directory index file "index.php" is not load
>>>> balanced if the request is "http://DOMAINNAME/", it only works as
>>>> "http://DOMAINNAME/index.php". How can I modify the
>> selection (or add
>>>> another) to capture the directory index php file when it
>> is not given
>>>> in the URL? (Apache/1.3.20 mod_backhand/1.2.0)
>>>>
>>>> I would be grateful for any help.
>>>>
>>>> Thomas
>>>>
>>>>
>>>> DirectoryIndex index.jsp index.php3 index.html index.htm
>>>>
>>>> <VirtualHost IPADDRESS:80>
>>>>     ServerAdmin [email protected]
>>>>     DocumentRoot /usr/local/httpd/htdocs/genieuk
>>>>     ServerName DOMAINNAME
>>>>
>>>>     ErrorLog  "|rotatelogs
>>>> /usr/local/httpd/htdocs/genieuk/stats/error_log
>>>> 86400"
>>>>     CustomLog "|rotatelogs
>>>> /usr/local/httpd/htdocs/genieuk/stats/access_log
>>>> 86400" combined
>>>>
>>>>     AddType application/x-httpd-php .php3
>>>>     <Directory "/usr/local/httpd/htdocs/genieuk">
>>>>       <Files ~ "(\.php3|\.php)$">
>>>>         Backhand byAge
>>>>         Backhand byRandom
>>>>         Backhand byLoad -3.0
>>>>       </Files>
>>>>     </Directory>
>>>> </VirtualHost>
>>>
>>>
>>> _______________________________________________
>>> backhand-users mailing list
>>> [email protected]
>>> http://lists.backhand.org/mailman/listinfo/backhand-users
>>>
>> // Theo Schlossnagle
>> // Principal Engineer -- http://www.omniti.com/~jesus/ //
>> Postal Engine -- http://www.postalengine.com/ // Ecelerity:
>> fastest MTA on earth
>>
>>
>> _______________________________________________
>> backhand-users mailing list
>> [email protected]
>> http://lists.backhand.org/mailman/listinfo/backhand-users
>>
>
>
>
> _______________________________________________
> backhand-users mailing list
> [email protected]
> http://lists.backhand.org/mailman/listinfo/backhand-users
>
// Theo Schlossnagle
// Principal Engineer -- http://www.omniti.com/~jesus/
// Postal Engine -- http://www.postalengine.com/
// Ecelerity: fastest MTA on earth