Intercept HTTP Errors in Domino

 
There are two different types of HTTP 404 Errors returned from a server, the missing file or the database error.

The Missing File 404 error message is a standard response when a database or a file is missing. Looking at the Domino URL, this is usually the full path including design elements. All the green part is usually considered the file name, example:
http://www.stdi.com/stdi/home.nsf/library!openView
This error can not be intercepted or redirected with two exceptions, a system wide custom error page can be sent to the browser, but the HTTP 404 Error is still unchanged. This makes sense if you consider web crawlers (yahoo, google etc) that don't want to cache invalid URLs, they depend on the 404 error code.
You can also handle the 404 Error in a database by adding the $$ReturnGeneralError forms. Now it is up to the Developer how view and document errors are handled. At this time, I'm not diving any further into this option and concentrate on the system wide error page.

You can however customize the error page that is returned to the browser. It is a configuration option in the browser and may not always produce the expected result.


If you are using the Microsoft Internet Explorer, the 404 error shows a help page that is generated by IE. This is NOT the message returned by the HTTP server or the custom error pages should one exist. IE ignores the custom page and shows it's own help page.

To disable the IE help page, you need to change the Advanced Options in IE as per picture to the right.
Goto > Tools > Internet Options
Open the Advanced Tab
Find Show friendly HTTP error messages
Uncheck the option.

Now you will see the error that is returned from the HTTP server.



This standard error message can be overwritten on the Domino server. This is documented in the Technote 1230036. To open the technote, go to http://www.ibm.com/support and enter the technote number in the search field. Then open the technote with the title Custom error page setting in httpd.cnf for non-NSF resources no longer works, or follow the instructions here.


I changed the error page to display the company logo and provide some help regarding the error.
Keep in mind, the 404 Error Code is still returned to the browser, only the page looks different. To accomplish this, you need a file with the HTML code and a NOTES.INI setting that points to the file.

Create a file with the HTML code in it. This example uses a file with the name error.html
<html><head>
<META NAME="DESCRIPTION" CONTENT="Page Not Found">
<title>HTTP 404 Page Not Found</title>
<style type="text/css">
body {font-size:10pt; font-family:sans-serif; background-color:#883366;}
em {font-size:12pt; font-family:sans-serif; font-weight:bold; font-style:italic; color:#c06020; }
A:link { font: bold 12px Arial,sans-serif; color: #0066CC; }
A:visited { font: bold 12px Arial,sans-serif; color: #0066CC; }
A:active { font: bold 12px Arial,sans-serif; color: #0066CC; }
</style>
</head><body>

<div align=center><table border="0" bgcolor="#d0d0d0"><tr valign="top"><td width="780">
<table border=0><TR><TD width="100" align=left>&nbsp;</td>
<td><font color="#000000"><b>Your Company</b></font></td></tr>
</table><table border=0 bgcolor="#FFFFFF"><tr><td width="100" align=left>&nbsp;</td>
<td width="680" align=left><br>
<em>The page you requested is not available.</em><br><br>
Try one of the following:
<li>If you typed the address, verify the correct spelling
<li>If you were referred to this page, go to the <a href="/">home page</a> and navigate to the page.
<br><br><br><br></td></tr></table></td></tr></table></div>

The above HTML will produce a page like the one to the right.
Change the colored text to suit your needs and include links to point to more support pages.
The NOTES.INI variable you need to add is:
HTTPMultiErrorPage=/error.html
Copy the error.html file into the Domino/html folder under the Domino data directory.
Note: If you already customized your Domino Web server, the html files may be in a different folder. Check the Web Site documents for the exact location. You could use different pages depending on the website.

The Database Error 404 error message is configured in the domcfg.nsf. If the database doesn't already exist, create a new one called domcfg.nsf in the data directory (use all lowercase). The database must be created from the advance template Domino Web Server Configuration (domcfg5.ntf). The Domino Web Server Configuration database maps the Login, Password and Error Pages. Every configured website can have it's own, unique setup.

To create the error messages, map the individual error to a custom form. The different errors are:
  • General Errors
  • Authentication Failures
  • Authorization Failures
  • Password Expired Errors
  • Password Change Not Allowed Errors
  • Password Change Submitted Responses
  • Document Deleted Responses

    For this document here, the one I'm interested in is the General Errors. It is a bit confusing which error is triggered. The two examples here should shed some light on the mistery.

    Example 1: http://www.stdi.com/notExisting will display the error as per configuration in the NOTES.INI
    Example 2: http://www.stdi.com/notExisting.nsf will display the error as per General Errors configuration in the domcfg.nsf
    When the URL looks like a Notes Database as per Example 2, then the domcfg.nsf page is returned.

    First published on October 23, 2010

  • Timestamp: 06/25/2017 08:08:22 AM EDT [on srv7cps]
    1996 - 2017 STDI Consulting Inc.
    All Rights Reserved