Re: HTTPRedirectoToName

Theo Schlossnagle <[email protected]> Wed, 25 Jan 2006 20:35:21 -0500
Newsgroups gmane.comp.apache.mod-backhand.general
Message-ID <[email protected]>
On Jan 25, 2006, at 8:30 PM, Rob Bloodgood wrote:

> Rob Bloodgood wrote:
>>>> 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
>>>>
> ...
>>>> 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.
>
> OK, there was a missing piece to my story.  The host named count1 is
> actually named count, and I was "getting to it" to name it count1.
> Well, I thought about that.  The server that I'm renaming to count1 is
> getting all its hits with the Host: count.example.com.  So if I change
> the apache config so that the local server name is count1, then I  
> have a
> chance at the redirect logic letting me through.
>
> So I tried it.
>
> at first, I was disappointed again.  but I had played with my module
> loading order a little bit, since I had thought about that while
> composing my earlier message.  I had moved mod_perl.c and  
> mod_backhand.c
> to be the first two modules in the list.
>
> Since I was having issues, I reversed that step, placed those two
> AddModule directives back at the end of the list, and it started  
> working!
>
> *AND*, my supposition was correct!  changing the internal server  
> name to
> count1 when the incoming Host: headers all say count.domain.com made
> redirection start working for me.
>
> Unfortunately... that does mean that I end up with one additional
> redirect for requests I handle "myself" (where redirects to count1
> happen to be the same box as the "Host: count").  But that should be
> pretty painless in terms of load.
>
> Comments?

You've achieved the intended use-case:
http://www.backhand.org/ApacheCon2000/EU/img23.htm

Glad you got it working.