nested ErrorDocuments not working

I just realized that nested ErrorDocuments are not working in my older 3.1.1 copy (I will have to wait until a lighter load overnight to upgrade to the 3.1.1 final release but this might be wrong in both)

ie.

/public_html/missing-example.html can have one errordocument in htaccess

/public_html/images/missing-image.jpg could be a lower level .htaccess in images overriding the one above it

Works perfectly in apache. Not in LiteSpeed. LiteSpeed shows the top ErrorDocument. Actually, possibly the LAST errordocument for that error code it processed.

ie.
/.htaccess
/images/.htaccess
/blog/.htaccess

The errordocument for 404 in /blog/ will be shown if a 404 occurs in /images/ or /

At least in my working server. You might want to test this on 3.1.1 production, otherwise I will also test it on the latest tonight.

I've traced the additional nested htaccess errordocument issues to litespeed being overly aggressive on rewrite issues in the topmost .htaccess

however the issue is so complex that I am having difficultly producing a simple example - will have to work on it - note that the issues do not exist when apache is running, it interprets the nested rules perfectly

I've traced the additional nested htaccess errordocument issues to litespeed being overly aggressive on rewrite issues in the topmost .htaccess

however the issue is so complex that I am having difficultly producing a simple example - will have to work on it - note that the issues do not exist when apache is running, it interprets the nested rules perfectly

Click to expand...

You can try turning on rewrite log by adding Apache directive "RewriteLogLevel 9" to the section of this vhost in your Apache httpd.conf. Send me the rewrite log and tell me which rewrite rule has been over processed along with the rewrite rules in your .htaccess files.

I built a 3.1.2 package for you with the fix to your rewrite rule. Just change the release number to 3.1.2 in the download link to get it.
Thank you for raising this issue, our target is to make our rewrite engine 100% compatible with Apache's, no matter is better or worse.

It is better to put all blog related rules under blog/ directory for better performance, the rewrite condition

Code:

RewriteCond %{REQUEST_FILENAME} ^/home/demosite/public_html/blog/.*$

can be removed, and only requests to /blog/... will go through those rewrite rules. Just a recommendation.

Thank you for the quick fix. I will give this a test in about eight hours as I have to wait for server activity to go down.

I assume you are able to reproduce this as I am dealing with a very complex set of rewrite rules and sometimes its hard to be sure they are all working at once without conflicting with each other and that it's not my own fault for a bad rule.

It helps though that I am able to stop lsws and start httpd within a few seconds of each other to test compatibility however.

On that note, keep in mind that apache DOES return the "missing" message on ErrorDocument with the same httpd.conf/htaccess however I will also give it a try with a raw browser tool I have like lynx - will post in a few minutes.

By the way, I have no idea what that 8 and 0 is before and after the apache ErrorDocument text is.

Is it part of the "chunked encoded" process where it's a segment of sorts?
Ah it might be the content-length for that segment of the chunked output.

Apparently I also accidentally left an end quote on the the "missing" when it should be just "missing - but I doubt that is what is messing up lsws right?

So is apache getting around the issue by using chunked output.
I notice apache also appends a charset, though nothing is specified in my htaccess, must be in httpd or some kind of default. Is it not important for litespeed to mimic that behavior? Will litespeed obey if I add this to htaccess?AddDefaultCharset iso-8859-1

LSWS does not treat HTTP/1.0 or 1.1 differently on this matter. Have you changed any configuration?

What testing tool are you using?
You should redirect the result to a file, as the last line of LiteSpeed output is too short, just "missing", without "\n", so it was overwritten by the command line prompt. It is there, just not visible from command line.

I think the issue you experienced is browser related. Have you tried it with other browsers?

I just tried the http 1.1 vs http 1.0 on the clean demosite account I had made under cpanel

LiteSpeed is definitely returning it's default 404 error page under HTTP 1.0 when there is an ErrorDocument present in htaccess

I will do a test with CURL to capture the exact http stream for 1.1 and 1.0

I have tested this in IE/Firefox/Opera - all fail the errordocument.

If you are getting different results on your test setup, then obviously this is a httpd.conf issue with the default cpanel setup I have, or possibly some option I have turned on inside LiteSpeed's config ?