Lucee Error Templates not showing up with IIS

Instead of the Lucee error templates, I just get the ubiquitous 500 - Internal Server Error.
How to I see the Lucee error templates, instead?

Thank You.

Don’t forget to tell us about your stack!

OS: Win Server 2019
Java Version: 11.0.7
Tomcat Version: 9.0.35
Lucee Version: 5.3.7.47

@KludgeMaker, Could you check Web Admin / Settings / Error.
In this page, you can look the error templates.

Thank You.
Yes, I see them there, and hope to do some customizing.
But how do I get those served to the user rather than the IIS 500 Error?

In your Application.cfc file, include an onError function that might do something like this:

<cffunction name="onError">
<cfargument name="exception" required=true> 
<cfargument name="eventname" type="string" required=true>
<cfmail to="support@yourdomain.com" from="support@yourdomain.com" subject="Lucee error">
<cfif structkeyexists(exception,"message")>#exception.message#</cfif>
<cfif structkeyexists(exception,"detail")>#exception.detail#</cfif>
#cgi.server_name#
#cgi.script_name#
#dateformat(now(),"yyyy-mm-dd")# #timeformat(now(),"HH:mm:ss")#
<cfloop collection="#url#" item="i">url.#i#: <cfif issimplevalue(url[i])>#url[i]#<cfelse>[complex]</cfif>#chr(10)#</cfloop>
<cfloop collection="#form#" item="i">form.#i#: <cfif issimplevalue(form[i])>#form[i]#<cfelse>[complex]</cfif>#chr(10)#</cfloop>
</cfmail>
<cfoutput>
[Your formatted HTML goes here]
</cfoutput>
</cffunction>

Thank You. I will definitely use much of this.
We are on the same page. My goal is to capture a snapshot of the errors that I can access after I wake up. May try to write a file instead of sending mail, but whatever.
I still wish I could serve up custom error messages to the user rather than that ugly IIS 500.
Thanks again!

The point of the [Your formatted HTML goes here] section above is that you can display your own page rather than the 500 error message

Well it works. And I’ll likely use it. Thank You.
It’s a very nice work-around, but why is it needed?
Why isn’t Lucee just serving up the custom error templates defined in the Admin?

you just need to disabled IIS showing the 500 page

1 Like