Virtual Hosts in Tclhttpd

(add configuration details for setting up virtual hosts in tclhttpd)

There is now a Virtual Host mechanism. You can load additional configuration files for different servers, and they are processed in different Tcl interpreters within your main server application.

The relevant commands in the httpd package appear to be:

 Httpd_VirtualHost host file 

Initialize a virtual server. The file is an alternate config file, (e.g., "tclhttpd.rc"). The pages for each virtual server are processed inside their own safe interpreter.

 Httpd_VirtualHosts hostNames file

Like Httpd_VirtualHost except that the first argument is a list of host names. All of these share the same config file.

MHo 2009-09-22: Regardless of whether I specify -virtual on the commandline or use the Httpd_VirtualHost... from within my custom code directory, I always get this: package md5 is not present. Example:

 Loading code (2) from D:/Home/Arbeit1/pgm/WebSrv2/sites/testsite/custom
 package require md5 ->1.4.4<-
 package present md5 ->1.4.4<-
 D:/Home/Arbeit1/pgm/WebSrv2/sites/testsite/custom/VHost.tcl: package md5 is not present
 tclhttpd.exe 0.90, based on tclhttpd 3.5.1 and Tcl 8.5.6, modified 02/04/2009 22:54:55, MHo

I should notice that I'm using my own Tclhttpd Winservice. The content of VHost.tcl is:

 puts "package require md5 ->[package require md5]<-"
 puts "package present md5 ->[package present md5]<-"
 puts [Httpd_VirtualHost name1 name1.rc]

andrewsh Yes, this is a known problem. It can be fixed, but hackishly. That's why I decided to implement it another way.

Alternative implementation is here.