[Seaside] Virtual Hosts served directly by Seaside WAKom

barger barger at barnet.sk
Sat Nov 18 06:50:19 UTC 2006




I am under upgrade to new version of Seaside, and in this case I was doing
some improvements which may be useful for someone else too.


Here is simple serving of Virtual Hosts directly by Seaside WAKom. 

Main class with simple url rewrite rule is WADispatcher:


handlerForRequest: aRequest relativeTo: base

            | path host name relativePath |

            path := aRequest url.

            host := (aRequest headers) at: 'host'.

            path size < 2 ifTrue:


            host = 'squeak.barnet.sk' ifTrue: [ path := path,'barnet' ].

            host = 'ges.barnet.sk' ifTrue: [ path := path,'ges' ].

            aRequest url: path.


            (base isEmpty or: [path beginsWith: base]) ifTrue:

                        [relativePath := path allButFirst: base size.

                        (relativePath notEmpty and: [relativePath first =
$/]) ifTrue:

                                   [name := (relativePath findTokens: '/')
at: 1 ifAbsent: [default].

              ^ entryPoints at: name ifAbsent: [

                                               entryPoints at: default
ifAbsent: [

new ] ] ] ].

       ^ WANotFoundHandler new



If you are interested you can download simple cs file here :

And test it here : 

http://squeak.barnet.sk <http://squeak.barnet.sk/> 

http://ges.barnet.sk <http://ges.barnet.sk/> 


Main reason is that I don't want to run more images on the same machine on
different ports and also I dont want to study how to fool requests by Apache
modules. Today I will add https ssl by stunnel for handling secure
connections by the same squeak image. If you are interested in permanent
link implementations I can post updated version later too. Old is here :


Jan Barger

www.barnet.sk <http://www.barnet.sk/>  





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20061118/4db0312b/attachment.htm

More information about the Seaside mailing list