Hi Tom,
Thanks for the complete info, and the research you've done.
The issue you described unfortunately can't be fixed.
It has to do with a combination of using mod_vhost_alias (for VirtualDocumentRoot) and mod_proxy.
Simply said, mod_proxy disables the use of mod_vhost_alias.
You can even see it in your Apache debug output: when you disable proxying for the given virtualHost, you will see the correct document-root at the "Request header [X-Tomcat-DocRoot]" log line. Assuming you have debugging turned on btw: LogLevel debug + LogHeaders true.
Both modules use the same "hook type" to execute their code, called ap_hook_translate_name.
Mod_proxy runs first, and when it finds a url it can proxy, it aborts the rest of the hook functions of this type. Meaning mod_vhost_alias is never called.
Sorry to see there is nothing we can do.
Kind regards,
Paul Klinkenberg
p.s. you don't want to know the amount of investigation I have done before I finally came to this conclusion 😭 I really thought it was fixable.
The warning "don't use this" at the ap_document_root documentation is outdated since apache httpd 2.4 imho, no idea why they kept it there. The ap_document_root function since 2.4 first checks a request-specific document_root, before returning the default:
https://github.com/apache/httpd/blob/trunk/server/core.c#L853