Pete Freitag Pete Freitag

Tomcat Virtual Directory Howto


Let's create a Tomcat virtual directory (or Alias) called /my_scripts which points x:\cf\cfusion\wwwroot\cf_scripts\scripts\ by adding the following inside of a <Host> tag in the server.xml file:

<Context path=""
    <PreResources base="x:/cf/cfusion/wwwroot/cf_scripts/scripts"

A few things to note:

  • Take a backup of server.xml first, if you end up with invalid XML or configuration the server will not start up again until you fix it.
  • You will need to restart Tomcat / ColdFusion for the change to apply
  • Note that I am using / forward slashes in the paths to avoid escaping backslashes.
  • Assumes my tomcat webroot is x:/cf/cfusion/wwwroot
  • Assumes my tomcat temp directory is: x:/cf/cfusion/runtime/conf/Catalina/localhost/tmp
  • Assumes I'm using Tomcat 8.5 or greater (eg CF2016+)

The syntax for creating a virtual directory in Tomcat changed in Tomcat 8.5, if you are using Tomcat 8, Tomcat 7 (CF10 or CF11) or below you will need to use a syntax like this:

<Context path=""

Like this? Follow me ↯

Tomcat Virtual Directory Howto was first published on July 03, 2019.

FuseGuard Web App Firewall for ColdFusion

The FuseGuard Web Application Firewall for ColdFusion & CFML is a high performance, customizable engine that blocks various attacks against your ColdFusion applications.


Thank you very much for this bit; it helps a lot if you erraneously have changed the script directory in cfadmin, forgetting that the admin uses the built in webserver and not iis ... ;-)
by Ralf_G on 11/12/2019 at 7:40:58 PM UTC

Post a Comment