Select Page

Serving A Bypassable “Down For Maintenance” Page In ColdFusion 2021

Published: March 14, 2022

In the vast majority of cases, updates to my ColdFusion blog can be made while the site is online. Sometimes, however, if those changes are not backwards compatible, or require too much cross-file coordination, there’s no way that I can start making changes without causing errors in the user experience (UX). In such cases, I need to temporarily block access to the site using a “Down for Maintenance” page. But, I still need to access the site in order to monitor and test the changes. As such, this maintenance page needs to be conditionally bypassable. Luckily, all of this is really easy in ColdFusion.

InVision, we manage our maintenance page at the outer-most ALB (Application Load Balancer). This way, we actually prevent traffic from entering most of our network.

You could also change the routing or virtual-host bindings at the web server level – think nginx, Apache, or Microsoft’s Internet Information Service (IIS). This way, you’re actually rendering a different “site” when users hit your domain.

In a ColdFusion application, you can override the page template in your onRequestStart() event-handler. This allows you to leverage the full-force of your ColdFusion business logic when rendering the maintenance page. But, it means that your ColdFusion application has to be boot-strappable; which it may not.

Which leads me to the approach that I am using, as outlined in this blog post. As you’ll see below, I’m including the maintenance page template as the very first operation in my Application.cfc – a template which renders the maintenance page for the user and then aborts the rest of the request. This approach limits what we can do in the maintenance page (for example, there is no application scope). But, it also means that we don’t have to worry about our ColdFusion application being in a “working state”.

Edit This Cookie Chrome extension to manually add the maintenance page bypass cookie to my current browser session. And, once this cookie is in place, my next request to the site bypasses the maintenance template and allows the request to enter the underlying ColdFusion application:

The underlying ColdFusion application being rendered because the down for maintenance template is being bypassed with the appropriate cookie value.

At that point, I can personally test the updates being made to the site even while everyone else is still seeing the down for maintenance page.

Once I’m done validating all the changes, I then comment-out the CFInclude statement at the top of the Application.cfc ColdFusion application component and then redeploy it. At this point, all incoming traffic will be directed to the ColdFusion application and all will be happy!

Again, I must emphasize that there are a thousand-and-one ways to accomplish something like this. This is just the approach that I use because it balances functionality with simplicity. This approach may not work for your situation.