Wednesday Sep 24, 2008

Why sometimes we cannot see the custom errors in IE ?

Sometimes, you have configured the web server to return custom errors, e.g. in obj.conf,

Error fn="send-error" code="404" path="<path>/error404.html"
Error fn="send-error" code="401" path="<path>/error401.html"
Error fn="send-error" code="403" path="<path>/error403.html"
Error fn="send-error" code="405" path="<path>/error405.html"
Error fn="send-error" code="500" path="<path>/error500.html"

But you can see the above custom error pages ok in Firefox and telnet test,

e.g.

apple:> telnet localhost 61801
Trying 127.0.0.1...
Connected to localhost.
Escape character is '\^]'.
GET /nono1.html HTTP/1.1
Host: apple

HTTP/1.1 404 Not found
Server: Sun-ONE-Web-Server/6.1
Date: Wed, 16 Jan 2008 10:02:35 GMT
Content-length: 44
Content-type: text/html

this is a customer error page, crowded.html

But you will see IE showing its standard error, e.g.


But not the custom error page, why ?

This can be because of the IE option "Show friendly HTTP error messages" in the Advanced tab in Internet Options.

See  below,

This will  force the IE to show its  friendly HTTP error messages  in  404,  401, 500  status code, instead of the custom errors sent out by web server. This is why you can see the custom error ok in Firefox and telnet test, but not in IE sometimes. If you uncheck this option, then restart IE, then you can see the custom error page in response to a 404 Not Found.

If you really want your custom error page shown in IE, then one possible workaround (although I do not recommend, because changing status code is not a good idea/practice in general).

You can add this below in obj.conf to change from , e.g. 404 to 306 which is unused.

(see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.7

"
10.3.7 306 (Unused)

The 306 status code was used in a previous version of the specification, is no longer used, and the code is reserved.
"     )

Service method="TRACE" fn="service-trace"
<Client code="404">
Output fn="set-variable" error="306 Not Found" noaction="true"
Error fn="send-error" path="/export/home/iws6.1sp8/docs2/crowded.html"
</Client>
Error fn="error-j2ee"
....

Then, IE can see the new custom error page because now we change its status from 404 to 306. IE does not have a friendly error page for 306, so it will show our custom error page now. However, I have to say again - I do not recommend this. It is shown here just in case you really need to workaround this IE option to show your custom error page.

About

Wing-Yip Walter Lee

Search

Categories
Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today