ModCFML

An In Depth Look at Mod_cfml

What is mod_cfml.pm?

Mod_cfml.pm is the one of the Web Server Components that are part of the mod_cfml suite. In particular, it is the Apache module that sends the web site configuration information off to the mod_cfml Tomcat Component.

What kind of configuration information is mod_cfml passing to Tomcat?

Specifically, mod_cfml records the "Document Root" value as reported by the mod_perl API's. mod_cfml utilizes the Apache2::RequestUtil package and passes the result of the document_root function off to Tomcat. Full documentation on the document_root method for the Apache2::RequestUtil package is here:

-> http://perl.apache.org/docs/2.0/api/Apache2/RequestUtil.html#C_document_root_

Exactly how does mod_cfml get the document root information to Tomcat?

The approach that mod_cfml takes is to "ride" existing methods. That is, mod_cfml modifies the INCOMING reuqest headers to include an additional header: the "X-Tomcat-DocRoot" header. This header, as well as additional host information such as the "hostname" is read and utilized by the Tomcat Valve to dynamically create a host for all hosts on the server.

How does mod_cfml know what request headers to modify?

Modifying the incoming request header information for specific requests can cause problems depending on the kind of request that's being passed. Requests for images, for example, do not always complete properly if they contain stange headers like a "X-Tomcat-DocRoot" header.

To protect from these potential problems, mod_cfml reviews incoming requests and only modifies those requests that match its "CFMLHandlers" directive. That is. the kinds of files mod_cfml is supposed to "handle". By default, the CFMLHandlers attribute is set to a value of ".cfm .cfc .cfml". This means that only incoming requests for files that contain that string will be modified. Default documents are also modified as a built-in function of mod_cfml.

Can mod_cfml handle SES URL's?

Yes. mod_cfml modifies requests for default documents as a built-in function, so all SES URL's will be modified and can be safely utilized with mod_cfml along with mod_proxy or mod_jk.

What are the performance implications of mod_cfml.pm?

Mod_cfml, thankfully, is a very very small piece of software in terms of most software. It's memory footprint and compile times are almost imperceptable. However, mod_cfml will add a small amount of time to each request. No official benchmarking has been done, our simplistic tests indicate that mod_cfml.pm adds less then 1ms to each request.

Can I run mod_cfml.pm in a cluster environment?

Yes. Mod_cfml.pm works well in a cluster systems that deal with many domains and system administrators can potentially save a great deal of configuration time by using mod_cfml.pm.

Why did you choose o write mod_cfml.pm in Perl instead of C?

Mostly because I find Perl easier to write then C. Even so, a C-based version is in planning, and mod_cfml's next Apache Component will probably be written in C (most likely as an extension of mod_proxy - similar to mod_proxy_ajp).

Can I use mod_cfml with web languages other then CFML?

Yes. mod_cfml was developed by the CFML community, but can easily be utilized by other languages that are supported in Tomcat, such as JSP.