[Seaside] [Q] FastCGI + Squeak?

Lukas Renggli renggli at gmail.com
Mon Feb 20 23:44:04 UTC 2006


> It looks like you're using mod-rewrite as opposed to mod_proxy..
> What's the general consensus on which is better/easier?  I'll argue
> that mod-proxy is not very easy to setup in my opinion,

I never used mod_proxy, so I can comment on this. However the rewrite
rule I gave as an example is also doing a proxying (i even think
internally it is using mod_proxy):

RewriteRule ^/(.*)$ http://localhost:8080/seaside/app/$1 [P,L]

^/(.*)$ is a regular expression matching the incoming request-url, in
this case it matches everything.

http://localhost:8080/seaside/app/$1 tells apache how to rewrite the
url, in this case it simply takes everything after the slash $1 and
appends it to http://localhost:8080/seaside/app/.

[P,L] tells apache what to do with the rewritten url. P(roxy) means it
should proxy the request to the generated url. L(ast) means it should
not try to apply any other rule, if this one matched.

For this example you need to go to the config-interface of your
application and set the base-path to "/". That's all.

This was a very simple example, where everything was passed to one
Seaside application in one Squeak image. You can also think of
something that passes different paths to different applications and
images (note the different ports):

RewriteRule ^/foo/(.*)$ http://localhost:8080/seaside/foo/$1 [P,L]
RewriteRule ^/bar/(.*)$ http://localhost:8080/seaside/bar/$1 [P,L]
RewriteRule ^/(.*)$ http://localhost:9090/seaside/zork/$1 [P,L]

For the above applications you need to set the base paths to "/foo",
"/bar" and "/".

You might also want to serve static files for certain sub-directories,
e.g. the first rule matches any URL starting with /resources/, leaves
it unmodifies - and is the last applied rule. So only request not
starting with /resources/ will be passed to the seaside application,
else they are handled by apache internally.

RewriteRule ^/resources/.*$ - [L]
RewriteRule ^/(.*)$ http://localhost:9090/seaside/zork/$1 [P,L]

Tell me if you need more examples.

Actually I prefer programming in Squeak than writing rewrite-scripts,
but it can be fun from time to time: as an example rewrite-maps can be
fun for mass-seaside-app hosting ;-)

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch


More information about the Seaside mailing list