View Single Post

  #1 (permalink)  
Old 11-28-2006
George Cooke
 
Posts: n/a
Default resin can do regex based hosts, (why|how) can('t) apache?

I want to define a VirtualHost based on a regular expression match, like
this (pseudo directives):

<VirtualHost .*mysite\d*\.com>
DocumentRoot /blah/mysite.com
other virtual host specific apache directives here...
</VirtualHost>


<VirtualHost .*myothersite\d*\.com>
DocumentRoot /blah/myothersite.com
other virtual host specific apache directives here...
</VirtualHost>

I would like to have the configs separate so that if one is not enabled
(a2dissite) then the default site will be used (how it should be).

The sites rely on the host header for content.

The obvious first choice is mass dynamic virtual hosts, but I can only
find the option of interpolating various request variables into the
virtualdocumentroot, which will not work (unless I create lots of
symlinks for each different host, dont want to do that) plus then all
the configs are placed together in one spot, i prefer separate as stated
above.

mod_rewrite is good, i use it for other stuff, but I cannot configure a
vhost depending on a rewriteCond... I could rewrite to directories based
on rewritecond host and separate the logs with logformat, but again, the
conf would all run from the default site, which is pants.

mod_setenvif provides me to match a host and set a var, but once again I
cannot really utilise this env= to conditionally configure a
virtualhost, only customlog and lots of cgi stuff i dont need.

What I really need, is a way to conditionally set a documentroot (and
other apache virtualhost context directives) based on a regular
expression against the host header, is there any way you can think of
that would enable me to do this??

http://www.caucho.com/resin-3.0/config/resin.xtp#host - look at regexp
host, this is what i want to be able to do, there is a module for
apache but i think you need the resinconf server or whatever running
which is a bit beyond the point really.

I would love to make a module to do this, any direction would be helpful.