On Tue, May 06, 2003 at 06:11:18PM -0500, Luke Opperman wrote:
>
> > >I need to separate out different ww applications, so that:
> > >
> > >http://x.com/cgi-bin/wkcgi/context-x/page and
> > >http://y.com/cgi-bin/wkcgi/context-y/page work, and
> > >
> > >http://x.com/cgi-bin/wkcgi/context-y/page and
> > >http://y.com/cgi-bin/wkcgi/context-x/page return 404 errors.
> > >
> > >Surely this must be a common problem, but I can't find mention of
> > it.
>
> I think I may be one of the few folks on here running numerous
> websites via Webkit, but with one instance (using contexts). They are
> all virtual hosts, our solution is to use mod_webkit so that wkcgi/
> is never directly available.
>
> So all content (with the exception of images and certain defined
> directories) on http://x.com/(.*) is transparently re-written to
> http://x.com/wkcgi/context-x/$1. (Actually, we use /WK mod_webkit,
> but the same idea holds.) We also do a little munging so that /WK is
> not accessible via any non-WebKit sites that happen to be running on
> the server, but that's optional.
>
> Summary: I recommend using mod_rewrite to hide full webkit access.
>
> (I assume you're using Apache; we have a similar setup on IIS, but
> there is no builtin equivalent to mod_rewrite, so we use a small C++
> ISAPI rewriter written using Boost::RegEx. Let me know if that's your
> situation, and I'll point you in the right direction. But it looks
> like you're using apache.)
>
> - Luke
I've got apache, but I'm trying to migrate to thttpd, hence using wkcgi
and no mod_rewrite. I have used the following in my sitepage class:
def respond(self,trans):
if trans.request().serverDictionary()['SERVER_NAME'] in self.getallowedsitenames():
SidebarPage.respond(self,trans)
else:
res = trans.response()
res.setHeader('Status', '404 Error')
res.write("""<html> ....
(my site class is derived from SidebarPage)
This works for what it does, but as others have alluded to there are
other problems, eg. sessions are shared between sites (contexts), so
loggin in at one site means you are logged in at all of them. I need
more code to clear the session state when switching sites. (Or do this a
different way.)
My situation is that all the webware sites are written by me, I'm not
renting out virtual servers, I'm developing website solutions for
clients myself, so I have control over the code. I considered having
separate webware installations for each client, and in many ways this
would be the best solution, but it seems like overkill for a few lightly
used sites. (and I don't want to clutter my ps listing :)
Alex
|