Re: HTTPRedirectoToName

Theo Schlossnagle <[email protected]> Wed, 25 Jan 2006 17:16:54 -0500
Newsgroups gmane.comp.apache.mod-backhand.general
Message-ID <[email protected]>
Rob Bloodgood wrote:

>I would really love to figure out how this directive is supposed to be
>useful.
>
>I'm setting up backhand, and I have set up a pair of servers to share
>the load of the machine that's getting backhand on it.
>
>(I'm already using mod_log_spread, presently I'll be setting up wackamole).
>
>The problem I have, which I'm not sure will be solved until I get
>wackamole going, is that doing backhand by proxy keeps my "main" server
>too busy, because instead of just handling (too many) requests, It's
>handling the same number, but also proxying some of them via backhand.
>So when I discovered HTTPRedirectoToName, I thought, this is cool, I can
>just redirect instead of proxy!
>
>Only... it doesn't.
>
>I have count1, count3, count4 boxen in my backhand cluster.  count1 is
>the "main" box that I'm trying to load balance.  I want count1 to
>redirect requests over to count3/count4 based on load, etc.  So I have:
>
><LocationMatch "/backhanded/.+">
>
>     Backhand byAge 2
>     # Backhand removeSelf
>     Backhand byLoad
>
>     Backhand HTTPRedirectToName %1S.%1H
>
>     # Backhand HTTPRedirectToIP
>     BackhandLogLevel +netall,+mbcsall,+dcsnall
>     # BackhandLogLevel +dcsnall
></LocationMatch>
>
>Now, looking at the surface, this should work great.  However:
>
>[Wed Jan 25 13:42:31 2006] [notice] Func executed for (null)
>[HTTPRedirectToName(%1S.%1H)] (3 -> 0)
>[Wed Jan 25 13:42:31 2006] [notice] New server list: [ ]
>[Wed Jan 25 13:42:31 2006] [notice] All funcs executed -> local
>
>
>I went ahead and looked at the source of builtins.c.  From what I can
>tell, it takes the incoming Host: header and uses it to assemble a hostname.
>
>HOWEVER, the logic in HTTPRedirectToName() says:
>  1. do hostname stuff with *ME*, first. (%1S.%1H) if the name matches
>my actual hostname, never mind.
>  2. do hostname stuff with the server we selected to backhand to.
>assemble a hostname out of server plus the domain, (%1S.%1H) and then
>redirect to that host.
>
>point 2 is what I was shooting for.
>
>as far as point 1:
>What?????? It will *always* match, and then clear the server list,
>unless the request contains a Host: header that... what, refers to a
>different machine?  Is that even possible?
>
>... Instead of seeing whom to redirect to and using HTTPRedirectToName()
>to assemble a full hostname to send to, the logic says, if I am me, and
>the Host: header is to me, then I don't backhand.
>
>It falls off and prevents doing anything useful before the actual,
>desired behavior: pick a host that's not me (if conditions are met) and
>redirect to it (instead of proxying).
>
>Have I completely missed the point of this directive, or used it wrong?
>
>  
>
Not missed the point.  It prevents the possiblity of an d enless set of 
redirects. where you just bounce back and forth all the time.

The goal is to go to www.exmaple.com and then have that be no-one's 
hostname.  The three hostnames are www.de.exmaple.com, 
www.us.example.com and www.jp.exmaple.com.  Once you hit 
www.XX.exmaple.com, that logic will prevent you from yet again being 
redirected.

Perhaps you already figured that out, I misunderstood and there is a 
bug?  Certainly possible.  It is one of the least used features in 
mod_backhand.

-- 
// Theo Schlossnagle
// Principal Engineer -- http://www.omniti.com/~jesus/
// Ecelerity: Run with it. -- http://www.omniti.com/