Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

When using the built in web server, is there a way to specify a different

New Here ,
Oct 12, 2012 Oct 12, 2012

When using the built in web server, is there a way to specify a different error handler when you try to access a NON .CFM file? Right now I get the standard:

java.io.FileNotFoundException: filename.ext

Is there any setting to override this and direct the message to your own .cfm template? The missing template handler in the CF Admin work only for .cfm files.

Thx

914
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 13, 2012 Oct 13, 2012

I think that it is so by design. ColdFusion is configured to process files with extensions .cfm, .cfc, .cfml, .cfr, .jsp, and so on. If the extension of the requested file is not in this list, for example filename.ext, the request will pass to the web server for handling. So, even if it is possible for you to customize the 404 handler (and it usually is), you will have to do so in the (XML) configuration files of the web server.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 13, 2012 Oct 13, 2012

Do you know how/where to change this using Coldfusion's built in webserver?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 13, 2012 Oct 13, 2012

It depends on version. What's your ColdFusion version?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 13, 2012 Oct 13, 2012

Coldfuion Version 8

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 14, 2012 Oct 14, 2012
LATEST

The in-built web server for ColdFusion 8 is JRun. I am on ColdFusion 10, however, and so cannot offer hands-on advice. (CF10 replaced JRun with Tomcat.)

My guess is that you have to modify the file {CF_ROOT}/WEB-INF/web.xml. Don't forget to create a back-up first!

You may then proceed as follows.

1) In the ColdFusion root (CF_ROOT), create the file myCustomFileNotFound.cfm. Give it some content, like

My custom File Not Found page. Current time: <cfoutput>#now()#</cfoutput>

2) Open the file {CF_ROOT}/WEB-INF/web.xml in a text editor. Add the following error-handling specification just before the end tag </web-app>:

<error-page>

<error-code>404</error-code>

<location>/myCustomFileNotFound.cfm</location>

</error-page>

Save the file web.xml.

3) Restart ColdFusion. Test by browsing to a URL requesting filename.ext

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources