How to direct traffic based on URL
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Perlbal > How to direct traffic based on URL




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    How to direct traffic based on URL  
Max Michaels


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-12-05 10:50 PM

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







[ Post a follow-up to this message ]



    Re: How to direct traffic based on URL  
Brad Fitzpatrick


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-12-05 10:50 PM

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
>
>






[ Post a follow-up to this message ]



    Re: How to direct traffic based on URL  
Brad Fitzpatrick


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-13-05 10:50 PM

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\-\_\.\*]+$/;
> --- 
>
> 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:
> 
>
>






[ Post a follow-up to this message ]



    Re: How to direct traffic based on URL  
Max Michaels


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-14-05 10:46 PM

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:
[vbcol=seagreen]
> 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:
> 







[ Post a follow-up to this message ]



    Re: How to direct traffic based on URL  
Brad Fitzpatrick


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-14-05 10:46 PM

I should've changed the error message.  Replace in your head "configured
vhosts" with "configured service".

You need to make two services (named delicious and delicious_rss) of type
reverse_proxy, setup with all the fancy options you desire, and then have
delicious use pool, say, "pool_regular" and delcious_rss service use pool,
say, "pool_rss".

- Brad


On Wed, 14 Sep 2005, Max Michaels wrote:

> 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:
> 
>
>






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:34 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register