[Seaside] apache + seaside

David Shaffer cdshaffer at acm.org
Fri Nov 25 22:04:37 CET 2005


Ross Boylan wrote:

>On Fri, Nov 25, 2005 at 08:36:15AM +0100, Cees De Groot wrote:
>  
>
>>On 11/25/05, Ross Boylan <RossBoylan at stanfordalumni.org> wrote:
>>    
>>
>>>When I enter the first URL I see my application.  However, when I hit
>>>a button on the form, my browser shows
>>>http://www.betterworld.us:81/seaside/test and I get the error that the
>>>URL is not found.
>>>      
>>>
>>You need to tell seaside about it, there's a base path configuration
>>setting (Resource Base Url). ProxyPassReverse doesn't do any rewriting
>>of returned HTML, just of URL's in the header (e.g. a Location: on a
>>redirect).
>>
>>    
>>
>I tried changing the Server Hostname in the applications configuration
>screen.  Is there somewhere else I should be tweaking?
>  
>
Yes:

    WADispatcher default baseName: '/'  "don't know if this will work,
never tried it"

That is probably all you need to do.

>Perhaps part of the problem is that I want to remove path elements as
>well as changing the hostname.
>
>By the way, Zope has a thing called a Virtual Host Monster that is an
>elegant solution to this problem.  You put something like this in
>Apache's configuration:
>RewriteRule ^/special/(.*)
>http://localhost:9674/VirtualHostBase/http/www.myhost.org:80/myapp/VirtualHostRoot/$1
>[L,P]
>
>Zope running on port 9674 interprets that to mean you want the object
>myapp/$1, and the generated URLS should appear to be from
>www.myhost.org:80.
>
>By the way, I think it would be more natural to have the myapp appear
>after the VirtualHostRoot,
>http://localhost:9674/VirtualHostBase/http/www.myhost.org:80/VirtualHostRoot/myapp/$1,
>but I think there's some historical reason for the other pattern
>(i.e., there was no /VirtualHostRoot in the first incarnations).
>
>  
>

Yes, that is kind of nice...dynamic decision of the base path.  You
could probably whip up a Decoration which does something similar.  With
seaside+apache as a proxy you have these options out of the box  (that I
know of):

    1) have apache rewrite all URL's coming and going from your
application (the link that I sent you describes how to do that)
    2) have your application produce URL's (anchors, form actions and
location: redirects) which specify the correct absolute path and allow
the browser to decide the server part (this an be accomplished by _not_
specifying a "server" in the application configuration but specifying
the WADispatcher default baseName: as I described above).

I almost always use 1 since I like to be able to hit the seaside server
without having to go through the proxy.  In practice I have a separate
space for seaside apps so the "/seaside" path works just fine for me. 
It's just a matter of proxying to the right port # (and from SSL to
non-SSL).  I use this to switch between two production images as well. 
There is an article floating around on using rewrites to load balance
with session affinity...I use this basic technique to switch between
production images (not for load balancing, just to move new sessions to
a newer version of my software).  If you really want more flexibility
with URL mappings then you're probably going to have to struggle a bit
to get there.  Keep us posted ;-)

David




More information about the Seaside mailing list