[Seaside] ProxyPass and the P Option

Ramon Leon ramon.leon at allresnet.com
Tue Nov 6 17:26:35 UTC 2007

> I guess I can do something like this:
> <VirtualHost>
> RewriteEngine       on
> ProxyRequests       off
> ProxyPreserveHost   on
> SSLEngine           on
> SSLCertificateFile  /etc/apache2/ssl/apache.pem
> DocumentRoot        /var/www/ssl
> ProxyPass           /seaside/go  balancer://seaside_cluster
> stickysession=MYCOOKIE  nofailover=on
> ProxyPassReverse    /seaside/go  balancer://seaside_cluster
> <Proxy balancer://seaside_cluster>
>     BalancerMember  http://localhost:9090/seaside/go  route=A_
>     BalancerMember  http://localhost:9091/seaside/go  route=B_
>     BalancerMember  http://localhost:9092/seaside/go  
> route=C_ </Proxy> RewriteRule  ^/$  
> balancer://seaside_cluster [P,L] </VirtualHost>
> Apparently, the format of the cookie name is something like 
> 'somename.someroute'. I think in the above example, somename 
> would be MYCOOKIE and someroute would be A_ or B_ or C_. Am I 
> understanding correctly?
> But do I need to setup cookies in Seaside? If so, do I need 
> to setup the cookie name format, as well? If so, how?
> Thanks,
> Richard

Have Seaside write out the image name in a cookie as the last step in your
initial request (making sure to grab any state you need first).

initialRequest: aRequest 
    self parseAnyNeededParams: aRequest.

    (self session currentRequest cookieAt: #server) 
        ifNil: [self session redirectWithCookie: 
                key: #server 
                value: 'seaside.', 
                    ((SmalltalkImage current imageName copyAfterLast: 
                        FileDirectory slash asCharacter) copyUpToLast:

And configure your cluster with the route=imageName

<Proxy balancer://seaside_cluster>
    BalancerMember  http://localhost:3001/seaside  route=imageName1
    BalancerMember  http://localhost:3002/seaside  route=imageName2

ProxyPass /seaside/files balancer://seaside_cluster/files
lbmethod=byrequests stickysession=server
ProxyPass / balancer://seaside_cluster/ lbmethod=byrequests
ProxyPassReverse / balancer://seaside_cluster/

Tell Apache what the cookie name is and it will have what it needs to parse
the cookie and route to the correct image.  I couldn't get this working last
time I tried but I was missing the information about the "." Apache was
expecting in the cookie, I chose HAProxy instead.  Now that this works, I
might have to switch back to Apache for load balancing, very nice!  Found
what I needed in

Ramon Leon

More information about the seaside mailing list