|
|

10-29-2007, 06:07 AM
|
|
Senior Member
|
|
Join Date: Aug 2007
Posts: 94
|
|
Erratic handling of custom error pages
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.
|

10-29-2007, 08:27 AM
|
|
LiteSpeed Staff
|
|
Join Date: May 2003
Location: New Jersey
Posts: 7,590
|
|
|
You configuration looks fine. We will verify this problem, if it is a bug, we will have it addressed in up coming 3.3 release.
|

10-29-2007, 10:23 AM
|
|
LiteSpeed Staff
|
|
Join Date: May 2003
Location: New Jersey
Posts: 7,590
|
|
|
The problem has been identified. fix has been added to 3.3 release package.
|

10-29-2007, 04:44 PM
|
|
Senior Member
|
|
Join Date: Aug 2007
Posts: 94
|
|
Quote:
Originally Posted by mistwang
The problem has been identified. fix has been added to 3.3 release package.
|
Supa-cool mistwang!
wfetch is a great tool BTW for doing these sort of tests:
http://www.microsoft.com/downloads/d...displaylang=en
It's a MS tool but it is extremely useful for a lot of things, including as they say 'It allows for very granular testing down to the authentication, authorization, custom headers, and much more.'
|

10-29-2007, 04:57 PM
|
|
Senior Member
|
|
Join Date: Aug 2007
Posts: 94
|
|
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.
|

10-29-2007, 06:01 PM
|
|
LiteSpeed Staff
|
|
Join Date: May 2003
Location: New Jersey
Posts: 7,590
|
|
|
No problem, we can add that feature easily.
|

10-29-2007, 07:18 PM
|
|
Senior Member
|
|
Join Date: Aug 2007
Posts: 94
|
|
|
Once again, thank you mistwang.
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 04:43 AM.
|
|