Hi,
I was under the assumption that there should be some sort of magic going on either with the Tomcat valve component or with Lucee, that would honour any Alias configuration inside an Apache VirtualHost. This seems to not be the case.
I have a directory /var/www/aliasdirs/webserver/example/
There are two files in this directory:
/var/www/aliasdirs/webserver/example/index.cfm
/var/www/aliasdirs/webserver/example/foo.txt
I have an Alias directive set up in the VirtualHost for luceetest.somehost.tld pointing /aliasdir/ to /var/www/aliasdirs/webserver/. The DocumentRoot for this VirtualHost ist pointing to /var/www/_luceedev/webserver/
I have turned on logging in both Apache and Tomcat; I have slightly renamed and/or deleted paths, Cookie values and shared key for security reasons and in order to keep the log-snippets small enough.
From the Apache-side, everything seems to be communicated alright, here are the relevant lines from the Apache log:
[Tue Jul 26 11:18:20.074213 2016] [modcfml:notice] [pid 17234] Handler Pattern Found => .cfm
[Tue Jul 26 11:18:20.074233 2016] [modcfml:notice] [pid 17234] Pattern Match TRUE: extension [.cfm] matches handler [.cfm]
[Tue Jul 26 11:18:20.074237 2016] [modcfml:notice] [pid 17234] Handler Pattern Found => .cfc
[Tue Jul 26 11:18:20.074239 2016] [modcfml:notice] [pid 17234] Handler Pattern Found => .cfml
[Tue Jul 26 11:18:20.074252 2016] [modcfml:notice] [pid 17234] Printing aliases: [2] found
[Tue Jul 26 11:18:20.074320 2016] [modcfml:notice] [pid 17234] 0. Alias: [/example/] -> [/var/www/aliasdirs/webserver/example/]
[Tue Jul 26 11:18:20.074326 2016] [modcfml:notice] [pid 17234] 1. Alias: [/icons/] -> [/usr/share/apache2/icons/]
[Tue Jul 26 11:18:20.074337 2016] [modcfml:notice] [pid 17234] URI => /aliasdir/example/index.cfm, filename => index.cfm
[Tue Jul 26 11:18:20.074340 2016] [modcfml:notice] [pid 17234] Incoming header [Host] => luceetest.somehost.tld
[Tue Jul 26 11:18:20.074342 2016] [modcfml:notice] [pid 17234] Incoming header [Connection] => keep-alive
[Tue Jul 26 11:18:20.074345 2016] [modcfml:notice] [pid 17234] Incoming header [Pragma] => no-cache
[Tue Jul 26 11:18:20.074347 2016] [modcfml:notice] [pid 17234] Incoming header [Cache-Control] => no-cache
[Tue Jul 26 11:18:20.074349 2016] [modcfml:notice] [pid 17234] Incoming header [Upgrade-Insecure-Requests] => 1
[Tue Jul 26 11:18:20.074351 2016] [modcfml:notice] [pid 17234] Incoming header [User-Agent] => Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36
[Tue Jul 26 11:18:20.074354 2016] [modcfml:notice] [pid 17234] Incoming header [Accept] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
[Tue Jul 26 11:18:20.074357 2016] [modcfml:notice] [pid 17234] Incoming header [Accept-Encoding] => gzip, deflate, sdch
[Tue Jul 26 11:18:20.074359 2016] [modcfml:notice] [pid 17234] Incoming header [Accept-Language] => de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
[Tue Jul 26 11:18:20.074361 2016] [modcfml:notice] [pid 17234] Incoming header [Cookie] => cb-enabled=accepted; LUCEE_ADMIN_LANG=en;
[Tue Jul 26 11:18:20.074366 2016] [modcfml:notice] [pid 17234] Incoming header [X-Tomcat-DocRoot] => /var/www/_luceedev/webserver/
[Tue Jul 26 11:18:20.074368 2016] [modcfml:notice] [pid 17234] Incoming header [X-Webserver-Context] => luceetest-somehost-tld-luceetest-somehost-tld-confl2
[Tue Jul 26 11:18:20.074370 2016] [modcfml:notice] [pid 17234] Incoming header [X-ModCFML-SharedKey] => someSharedKey
[Tue Jul 26 11:18:20.074373 2016] [modcfml:notice] [pid 17234] Incoming header [x-vdirs] => /example,/var/www/aliasdirs/webserver/example;/icons,/usr/share/apache2/icons;
catalina.out is somewhat inconclusive:
[mod_cfml] Counters have been reset (maxContexts, timeBetweenContexts)
[mod_cfml] Decoded Request URI => /aliasdir/example/index.cfm
[mod_cfml] QueryString => null
[mod_cfml] DocRoot Value => /var/www/_luceedev/webserver/
[mod_cfml] Webserver main Host => luceetest-somehost-tld-luceetest-somehost-tld-confl2
[mod_cfml] Alias Value => luceetest.somehost.tld
[mod_cfml] New contextRecord Array initialized...
[mod_cfml] lastContext = null
[mod_cfml] throttleValue = 0
[mod_cfml] Removing old config directory: /opt/apache-tomcat-8.5.3/conf/Catalina/luceetest-somehost-tld-luceetest-somehost-tld-confl2
[mod_cfml] Creating new config directory: /opt/apache-tomcat-8.5.3/conf/Catalina/luceetest-somehost-tld-luceetest-somehost-tld-confl2
[mod_cfml] Removing old work directory: /opt/apache-tomcat-8.5.3/work/Catalina/luceetest-somehost-tld-luceetest-somehost-tld-confl2
[mod_cfml] Creating context file: /opt/apache-tomcat-8.5.3/conf/Catalina/luceetest-somehost-tld-luceetest-somehost-tld-confl2/ROOT.xml
[mod_cfml] Creating New Host...
[mod_cfml] setName Value => luceetest-somehost-tld-luceetest-somehost-tld-confl2
26-Jul-2016 11:18:18.623 INFO [luceetest-somehost-tld-luceetest-somehost-tld-confl2-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor /opt/apache-tomcat-8.5.3/conf/Catalina/luceetest-somehost-tld-luceetest-somehost-tld-confl2/ROOT.xml
===================================================================
WEB CONTEXT (e9bfb90c9e4b1da6d1ee69b811ca20dd)
-------------------------------------------------------------------
- config:/var/lucee/config/web/e9bfb90c9e4b1da6d1ee69b811ca20dd (custom setting)
- webroot:/var/www/_luceedev/webserver/
- hash:e9bfb90c9e4b1da6d1ee69b811ca20dd
- label:e9bfb90c9e4b1da6d1ee69b811ca20dd
===================================================================
[mod_cfml] Verifying context files...
[mod_cfml] Redirect URL => '/aliasdir/example/index.cfm'
Lucee is not at all affected by the x-vdirs-header, it searches for the aliased directory below the document root and throws an exception:
"ERROR","ajp-nio-8009-exec-2","07/26/2016","11:18:26","",";Page /aliasdir/example/index.cfm [/var/www/_luceedev/webserver/aliasdir/example/index.cfm] not found;lucee.runtime.exp.MissingIncludeException: Page /aliasdir/example/index.cfm [/var/www/_luceedev/webserver/aliasdir/example/index.cfm] not found
I have tried with both SharedKey set and omitted (on both sides), so that's not it. Lucee version is 5.0.0.252. As a connector I am using mod_jk with this config:
JkMount /*.jsp ajp13_worker
JkMount /*.cfm ajp13_worker
JkMount /*.cfc ajp13_worker
JkMount /*.cfml ajp13_worker
JkMount /*.cfchart ajp13_worker
<Location /lucee/admin>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
AuthName "Lucee"
AuthType Basic
AuthUserFile /etc/apache2/lucee-admin.passwords
Require valid-user
Satisfy any
</Location>
libapache2-mod-jk is 1.2.37-4+deb8u1 from Debian Jessie. Tomcat is Version 8.5.3.
In order to save myself from having WEB-INF directories sprinkled all over the place, I have slightly changed the servlet configuration for Lucee to have them point to a special path:
<servlet>
<servlet-name>CFMLServlet</servlet-name>
<description>CFML runtime Engine</description>
<servlet-class>lucee.loader.servlet.CFMLServlet</servlet-class>
<init-param>
<param-name>lucee-server-directory</param-name>
<param-value>/var/lucee/config/server/</param-value>
<description>Lucee Server configuration directory (for Server-wide configurations, settings, and libraries)</description>
</init-param>
<init-param>
<param-name>lucee-web-directory</param-name>
<param-value>/var/lucee/config/web/{web-context-label}/</param-value>
<description>Lucee Web Directory (for Website-specific configurations, settings, and libraries)</description>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Except for this, everything else is configured just like it should. CFML-files are being served alright from the DocumentRoot. Just no luck at all with Aliases.
The same applies to any other Alias, for example the /icons/-Alias - static files are served alright, whereas anything that's handed over via mod_jk to Tomcat/Lucee is being searched under the DocumentRoot, where it throws a MissingIncludeException.
Is this not supposed to work at all? I am still somewhat mystified as to who or what exactly is responsible for dealing with the x-vdirs header in the expected manner.
Kind regards
Markus