I'd like to set up an environment where Apache virtual hosts can be dynamically created without reloading the configuration.
I can do this with mod_vhost_alias, I set up my default virtual host something like this
<VirtualHost *>
UseCanonicalName Off
VirtualDocumentRoot /var/www/sandboxes/domains/%0
ServerName catchall.host
</VirtualHost>
That works just fine, but if a request is made for a hostname which isn't currently set up, I get a 404 Not Found error.
What I'd really like to do is only have this VirtualHost kick in only if the document root exists, otherwise have it try to match another vhost (in other words, make the presence of the the VirtualDocumentRoot work in the same way as using a ServerAlias)
I tried making this the second vhost, with the first vhost just handling all requests, but this didn't work - requests for domains where a VirtualDocumentRoot was configured were falling through to the default vhost.
So, how can I have dynamically configured vhosts, but with a fallback to another vhost for any which aren't configured yet?