John’s Oracle Experiences

My everyday experiences with Oracle products

Errordocument fails to intercept internal 500 error

Posted by John Paul van Helvoort on January 13, 2009

When using your SSO server as a first login page for external users. You might want to catch ugly 401,404,500 errors and redirect it to a nice page so that the users are presented with a more meaningful message.

While testing with an 10.1.4.2.0 infrastructure i am able to do this by using the
standard ErrorDocument 500 … feature of Apache HTTP_Server. ( No extra configuration files needed or to be adjusted )
When i try to configure the same settings on a 10.1.2.0.2 infrastructure the error page 500 is not caught although other errors like 404 and 401 work. After searching Metalink i could find a couple of suggestions which should address this issue. Unfortunally this did not resolve my issue.

What i did to make it work on the 10.1.2.0.2 infrastructure is :
I’ve edited the dads.conf file and added the line, just before any Plsql… entry;

PlsqlErrorStyle ApacheStyle

I’ve edited the mod_oc4j.conf file and added the line , just above the Oc4jmount;

Oc4jUseOHSErrors on

The httpd.conf contains :

ErrorDocument 500 /error-pages/500.html
ErrorDocument 404 /error-pages/404.html
ErrorDocument 401 /error-pages/401.html

The directory and files are available under $ORACLE_HOME\Apache\Apache\htdocs\

Just to be clear, this config works on a 10.1.4 infra but not on a 10.1.2 infra.
the URL used to reproduce this is : http://testserver:7777/pls/orasso/orasso.wwsso_app_admin.ls_login?

After a long search and evaluation of the problem it seems to be neccessary to apply a patch on my 10.1.2.0.2 Application Server.

Inorder for custom messages configured via the ErrorDocument directive to apply to requests that have been service via the MOD_OC4J component, it is necessary to set the following entry in the mod_oc4j.conf file:

Oc4jUseOHSErrors on

But, users of Application Server 10.1.2 releases prior to 10.1.2.2, should upgrade to 10.1.2.2 or later to address the following bug:
Bug 4331689 MOD_OC4J “OC4JUSEOHSERRORS” DIRECTIVE NOT WORKING

After upgrading to this 10.1.2.2.0 i was able to catch the 500 message and replace it with my custom message.

Also turn of “Show friendly HTTP error messages” in your IE browser as it interfears with displaying plain errors.
When dealing with external users where you have no controle on the option being checked or not, made sure your custom error page is larger than 512 Kb.
When doing so “Show Friendly Messages” will not be activated and show your custom page as you like it to be shown.

3 Responses to “Errordocument fails to intercept internal 500 error”

  1. Timur I. said

    Great! Thank you!
    I always wanted to write in my site something like that. Can I take part of your post to my blog?
    Of course, I will add backlink?

    Regards, Timur Alhimenkov

  2. Hi Timur,
    Yes offcourse, you are more then welcome to do so.
    Kind regards,
    John Paul

  3. [...] However, to get this to take effect in an oc4j application (such as analytics) you need to change mod_oc4j.conf too.(I found this out from this post here) [...]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>