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:
Etc etc
Apply changes to server, graceful restart.
I then test this setup out by generating a 404 error like so:
and I get this response, with my custom error page HTML successfully being displayed:
My custom error code shows up fine.
Now I generate another error of a different type:
and I get this response - a 405 error with the LSWS **built-in** error message displayed, which I do not want.
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.
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>
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: */*
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
Now I generate another error of a different type:
Code:
REQUEST: **************
PUT / HTTP/1.1
Host: 123.456.789.12
Accept: */*
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>
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.