Erratic handling of custom error pages

brrr

Well-Known Member
#1
LSWS is erratic in the way it returns custom error codes.

For some errors it returns the correct custom error page, for some codes the in-built error codes are displayed DESPITE the custom error codes being set for that error type.

Setup is LSWS 3.2.4 Standard. I only have one listener, mapped to the only virtual host on the server ('Example') with a root at $SERVER_ROOT/DEFAULT/ and a document root at $VH_ROOT/html/.

I want my custom error pages to display, not the in-built ones that LSWS generates. So I setup my own error docs for 400, 401, 404, 405 etc error codes, as /error404.html, as you can see from the $VH_ROOT/conf/vhconf.xml:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<virtualHostConfig>
  <docRoot>$VH_ROOT/html/</docRoot>

  <customErrorPages>
    <errorPage>
      <errCode>404</errCode>
      <url>/error404.html</url>
    </errorPage>
    <errorPage>
      <errCode>403</errCode>
      <url>/403page.htm</url>
      <note></note>
    </errorPage>
    <errorPage>
      <errCode>400</errCode>
      <url>/error404.html</url>
      <note></note>
    </errorPage>
    <errorPage>
      <errCode>402</errCode>
      <url>/error404.html</url>
      <note></note>
    </errorPage>
    <errorPage>
      <errCode>405</errCode>
      <url>/error404.html</url>
      <note></note>
    </errorPage>
  </customErrorPages>
Etc etc

Apply changes to server, graceful restart.

I then test this setup out by generating a 404 error like so:

Code:
REQUEST: **************
GET /DSFSDFSDFSDFSDFSFS.HTM HTTP/1.1
Host: 123.456.789.12
Accept: */*
and I get this response, with my custom error page HTML successfully being displayed:
Code:
RESPONSE: **************
HTTP/1.1 404 Not Found
Date: Mon, 29 Oct 2007 12:28:53 GMT
Server: LiteSpeed
Accept-Ranges: bytes
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
ETag: "35d-471fb055-168009"
Last-Modified: Wed, 24 Oct 2007 20:51:33 GMT
Content-Type: text/html
Content-Length: 861

<html>
<head>
<title>404 Error - file not found</title>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head> 
etc etc
My custom error code shows up fine.

Now I generate another error of a different type:

Code:
REQUEST: **************
PUT / HTTP/1.1
Host: 123.456.789.12
Accept: */*
and I get this response - a 405 error with the LSWS **built-in** error message displayed, which I do not want.

Code:
RESPONSE: **************
HTTP/1.1 405 Method Not Allowed
Date: Mon, 29 Oct 2007 12:40:23 GMT
Server: LiteSpeed
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Cache-Control: private, no-cache, max-age=0
Pragma: no-cache
Content-Type: text/html
Content-Length: 384

<html>
<head><title> 405 Method Not Allowed</title>
</head><body><h1> 405 Method Not Allowed</h1>
This type request is not allowed!<hr />
Powered By <a href='http://www.litespeedtech.com'>LiteSpeed Web Server</a><br />
<font face="Verdana, Arial, Helvetica" size=-1>Lite Speed Technologies is not responsible for administration and contents of this web site!</font>
</body></html>
This built-in 405 error is displayed despite the fact that I have explicitly defined a custom 405 error of my own that I would prefer to have displayed.

Why is this so? Is it a bug or am I missing a config issue?

What works for the 404 should work for 405's, I would have thought, especially where I am using exactly the same file for the error message.
 

brrr

Well-Known Member
#4

brrr

Well-Known Member
#5
Oh, and a supplemental but related feature request - could the web interface to the Custom Error pages be amended to allow the direct specification of **plain text** to return for an error.

At the moment for example in APache 2.2 I can specify:

Code:
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 403 "Hello world"
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

ErrorDocument 400 "404 error - file not found"
ErrorDocument 401 "Unauthorised"
ErrorDocument 403 " "
ErrorDocument 404 "/missing.html"
ErrorDocument 405 "404 error - file not found"
ErrorDocument 408 "404 error - file not found"

etc
In LSWS I can do this I think via a .htaccess, but I can't do it via the web admin interface or by specifying it in the XML config. This is an inconvenience and an inconsistency.

I like using plain text error responses because they have performance advantages - less I/O, less traffic out, greater resistance to DDOS etc.
 
Top