using Cold Fusion, and thus have the “.cfm” file extension. When I view those
pages in my browser, they seem to work just fine. However I’ve been getting
reports of some people seeing raw HTML when the view those pages, and not the
formatted pages I’d expect. What’s up with that?
Well, the good news is that’s it’s most likely an easy, if obscure, fix that
you, or your webmaster, needs to do.
The “bad” news, if you want to call it that, is this: the browsers that are
showing you what you expect? They’re technically wrong.
Become a Patron of Ask Leo! and go ad-free!
What most people don’t realize is that the filename extension, the “.html”,
“.htm”, “.cfm”, “.php” and so on, is pretty much ignored by your browser. Sure,
it’s part of the filename, and it gets sent off to the web server when you view
a web page, but that’s really about it.
Your browser really doesn’t care or pay much attention to what the extension
The web server on the other hand, cares deeply.
The filename extension is used by the web server to know how to process the
request. By default, “.html” files, for example, are simply copied back down to
your browser, pretty much as is. “.shtml” files are pre-processed, and then the
results copied down. “.cfm” files are run through the Cold Fusion processor,
and the output is sent to your browser. “.php” files are run through the PHP
interpreter, and the output is sent to your browser.
But that’s only part of the story. When the server sends something down to
your browser, it also includes information that tells the browser what it is
it’s sending. For example your “.cfm” file may fire up the Cold Fusion
processor, but the results that get sent back down to your browser is just
plain old HTML. That makes it easy on your browser, because regardless what
wonderful technology was used on the server – Cold Fusion, PHP, or something we
haven’t thought of yet – the server just tells the browser “this is HTML”, and
the browser knows what to do with it.
The problem arises with unknown file types. If you have on your server a
file called “example.leo”, and you request it in your browser … well, the
browser doesn’t care that it’s a “.leo” file, it just asks the server for it.
The server, on the other hand, has no idea what a “.leo” file is, so it makes
an assumption: this must be plain text. And that’s what it tells the browser:
“this is plain text”. The browser should just display the contents of
the file, without formatting, much like if you had opened the file locally in
Now, in your case, it looks like your server knows what to do with “.cfm”
file requests: send them off to the Cold Fusion processor. But it looks like it
has not been configured to know that the output of Cold Fusion is HTML (or
alternately, Cold Fusion has not been configured to indicate that its output
is HTML). Your “.cfm” pages are probably coming out with the indication that
they are text, not HTML. (For the more technically inclined, the HTTP headers
returned include “Content-Type: text/plain” instead of “Content-Type:
But wait! It gets more confusing!
Several browsers, I assume to be “more helpful”, will attempt to display
pages marked as plain text as HTML anyway. (Presumably if it “looks like” HTML
to them.) So this means that even though your “.cfm” pages are incorrectly
indicating that their output is plain text, some browsers will incorrectly
treat it as HTML.
Two wrongs making a right, as it were.
Other browsers that actually pay attention to the content type, display the
output as plain text, which means displaying the raw HTML to their users.
So that was a very long explanation that boils down to this: the server
hosting your site is not configured to correctly indicate that “.cfm” output is
HTML. Exactly how to correct that will vary based on the type of server you’re
running, and may possibly involve settings within Cold Fusion itself.
† – ok, some browsers may pay attention to the filename extension
as a hint for what to do with the file. But technically, they’re probably not supposed