How to direct traffic based on URL

Max Michaels max at del.icio.us
Wed Sep 14 13:16:10 PDT 2005


Hey Brad,

Thanks again for your help. We here at del.icio.us owe ya one. So I've 
made a little progress and now the problem I'm running into is that 
when i request the pages. It is directing correctly to the vhosts, but 
it is saying that the vhosts aren't defined. I'm getting a 404 with the 
message "Not Found (no configured vhosts 'delicious')" or 
delicious_rss. I'm thinking that from looking at the example vhost 
config that vhosts aren't aware of Pools. Just a guess. My config is 
below. Thanks again for your help.

oad DeliciousSelector

CREATE POOL delicious_rss
         POOL delicious_rss ADD x.x.x.x6:80

CREATE POOL delicious
         POOL delicious ADD y.y.y.y:80

CREATE SERVICE balancer2
   SET listen          = z.z.z.z:80
   SET role            = selector
   SET plugins         = DeliciousSelector
ENABLE balancer2


Thanks again,

-max
On Sep 13, 2005, at 1:54 PM, Brad Fitzpatrick wrote:

> Well, the $host variable doesn't contain the URI request path, so it 
> won't
> match the "/rss" in your VHOST directive.
>
> Here, use this:
>
>    http://danga.com/temp/DeliciousSelector.pm
>
> Then load the plugin "DeliciousSelector" and remove your "VHOST" config
> lines.  I've hardcoded "delicious_rss" and "delicious" for your pool
> names.
>
> - Brad
>
>
>
> On Tue, 13 Sep 2005, max michaels wrote:
>
>> Thanks for hints, but I'm still having problems getting adjustments
>> to vhost.pm to work. Here's what I've change unsuccessfully:
>>
>> diff Perlbal-1.37.changes/lib/Perlbal/Plugin/Vhosts.pm
>> Perlbal-1.37/lib/Perlbal/Plugin/Vhosts.pm
>> 37c37
>> <             unless $host =~ /^[\/\w\-\_\.\*]+$/;
>> ---
>>>             unless $host =~ /^[\w\-\_\.\*]+$/;
>>
>> and here is my perlbal.conf:
>>
>> load Vhosts
>>
>> CREATE POOL delicious_rss
>>          POOL delicious_rss ADD x.x.x.x:80
>>
>> CREATE POOL delicious
>>          POOL delicious ADD y.y.y.y:80
>>
>> CREATE SERVICE balancer2
>>    SET listen          = 69.9.36.75:80
>>    SET role            = selector
>>    SET plugins         = vhosts
>>    VHOST del.icio.us/rss = delicious_rss
>>    VHOST del.icio.us = delicious
>> ENABLE balancer2
>>
>>
>> # always good to keep an internal management port open:
>> CREATE SERVICE mgmt
>>    SET role   = management
>>    SET listen = 127.0.0.1:60000
>> ENABLE mgmt
>>
>> It still seems to randomly choose and not differentiate. Any Ideas?
>>
>> Thanks!
>>
>> -max
>>
>> On Sep 12, 2005, at 1:17 PM, Brad Fitzpatrick wrote:
>>
>>> You'll have to write a service selector plug-in, which isn't as
>>> scary as
>>> it sounds.  Look at the Vhosts.pm plugin for virtual hosts (which
>>> redirects to a different pool based on hostname), and change it to
>>> work on
>>> the URLs that you want.
>>>
>>> - Brad
>>>
>>>
>>> On Mon, 12 Sep 2005, Max Michaels wrote:
>>>
>>>
>>>> Howdy,
>>>>
>>>> I was just wondering if there is a good guide out there on how to
>>>> redirect based upon what the URL is. For example, I want to direct
>>>> any
>>>> traffic that has /rss at the end of it to backend_server b and
>>>> everything else to backend_server a. Thanks!
>>>>
>>>> -max
>>>>
>>>>
>>>
>>
>>



More information about the perlbal mailing list