[web-devel] IDEA: wai-vhost

Dmitry Olshansky olshanskydr at gmail.com
Tue Nov 23 13:11:44 CET 2010

So you will have one executable for totally different applications?

I think there could be some problems on compilation with different
package-versions and/or the same module-names from different packages.
I don't know could it be resolved painlessly or not.

2010/11/23 Michael Snoyman <michael at snoyman.com>

> Just thought I'd throw out an idea I've been bouncing around and see
> if anyone would be interested in either using or implementing it.
> Basically, it allows multiple WAI applications to be run as a single
> app and switch which app responds to a request based upon the Host,
> the same way virtual hosting works in web servers like nginx, Apache
> or lighttpd. I would imagine the type signature would look something
> like:
> vhost :: [(String, Application)] -> Application -> Application
> The first argument would be a list of applications and their
> respective virtual hosts (this would probably be better as a Map for
> performance, kind of irrelevant at this point). The second argument
> would be the default application to run when none of the vhosts match.
> This could even just be an app that always returns a 404. It returns a
> new application handles all of this transparently.
> I can see two immediate uses:
> * Instead of running a whole bunch of WAI fastcgi processes on a
> server, you could run just a single process that automatically deals
> out requests to the right app. This would save on memory usage,
> especially when your apps are all sharing the same Haskell libraries.
> * Instead of needing a dedicated web server like nginx to handle
> vhosting, you could use the Snap handler with this and be running a
> pure Haskell stack. Advantage would be easier maintenance, plus better
> performance from cutting out the middleman.
> At this point, it's just an idea. I don't think it's hard to
> implement, but I wouldn't mind some feedback first. And if someone
> else wants to take a crack at it, please speak up! I wouldn't mind
> having one less package to maintain.
> Michael
> _______________________________________________
> web-devel mailing list
> web-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/web-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/web-devel/attachments/20101123/e3c7f24b/attachment.html

More information about the web-devel mailing list