In message <m3ekf9qzmp.fsf / asfast.com>, `Lloyd Zusman <ljz / asfast.com>' wrote: > I posted the following query to the webrick mailing list, but that list > has not been very active lately, and so I'm also posting it here, in the > hopes of reaching more WEBrick users: I'm really sorry to post this too late. > I want these virtual hosts to inherit directory mappings from the main > server, or from some sort of central resource. (snip) > Summary: > > I want virtual host 1 to inherit the /icons mapping from > the main server. > > I want virtual host 2 to inherit the /img mapping from > the main server. > > I want virtual host 3 to inherit both the /img and /icons > mappings from the main server. I considered your need is that all 404 requests to virtual hosts should be reprocessed by mainserver. I hope the following code helps you. require "webrick" class FallbackEnabledHTTPServer < WEBrick::HTTPServer def service(req, res) begin super(req, res) rescue WEBrick::HTTPStatus::NotFound => ex # resume request's attributes and invoke the fallback server. req.script_name = "" req.path_info = req.path.dup @config[:FallbackServer].service(req, res) end end end httpd = WEBrick::HTTPServer.new( :Port => 8080, :ServerName => "mainserver.com", :DocumentRoot => "./var/www" ) httpd.virtual_host( FallbackEnabledHTTPServer.new( :Port => 8080, :ServerName => "virthost1.com", :DocumentRoot => "./var/www/virthost1", :FallbackServer => httpd, :DoNotListen => true ) ) trap(:INT){ httpd.shutdown } httpd.start -- gotoyuzo