Coldbox Environment Interceptor updated to Support RegEx

The latest release of Coldbox 2.6.0 RC1 is like every other Coldbox release…Filled with goodies.

For now, I am keying in on the Environment Interceptor. It allows you to specify a different set of configuration settings based on the environment your application is running in. You are no longer limited to a single config file and the settings bound to it.

By default, Luis uses URLS specified in the environments.xml and looks for them in the cgi.http_host. While it is effective, I have always liked the flexibility of regular expressions.

I have updated the code to accept a PATTERNS attribute from the config xml file and use the pattern as a regular expression against the cgi.http_host.

It extends the environmentControl interceptor that is distributed with CB, and is completely backward compatible.

Get the CODE –

If you want to use the PATTERNS leave the URLS empty.

I thought about using both URLS and PATTERNS together, but with regEx you can pretty much capture any URL.

The environments.xml.cfm would look like:

The interceptor in the config.xml.cfm would look like:
(only difference here is the class path – no longer points to coldbox.system.interceptors)


For more on the latest release, check out What’s New in Coldbox 2.6.0

Leave a Reply

Your email address will not be published. Required fields are marked *