500 Internal Server Error generic Apache message. What creates this?

I’m deploying a java web application and defining my own custom error page inside my deployment xml but for some reason Apache always overrides my 500 page handler with its own generic message:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, you@your.address and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

I don’t have ErrorDocument set in httpd.conf. Does anyone know where this message could be defined?

HG,

Almost always, this is due to a syntax error (or unsupported directive) in your .htaccess file. Since this is your server, have you attempted to use mod_rewrite directives without removing the comment from the LoadModule directive for mod_rewrite?

Regards,

DK

Both LoadModule and AddModule for mod_rewrite are in httpd.conf. I can only find one .htaccess file and it’s under the document root and it contains:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{SERVER_PORT} !443
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L]

HG,

Remove the + from your first line and give that a go.

Personally, I alter the httpd.conf (of my test server) to avoid having to play with the Options FollowSymLinks et al in .htaccess.

Regards,

DK

Unfortunately that didn’t appear to make a difference. I can look in the error_log* file and see that the Content-Location header is being set to my error page url but it just never displays it.

HG,

Another tact: Have you setup the secure server properly. If not, Apache must throw an error. I don’t bother with that on the test server because I’m aware that Windows does not use a compatible security setup so I’d have to go get an app online to encode the encrypted part of that setup (and use a self-signed cert).

Regards,

DK

Well I don’t know why or who put that file there but it isn’t in any of the directories of my application or any URLs I am accessing. I removed that file just in case but it didn’t have any effect. In httpd.conf Port is set to 7777 and Listen to 7778. Not sure why they are different. I didn’t set up this configuration but am the one working on it now.

HG,

Because you’re attempting to redirect to https, that’s on port 443 unless you specify differently (check the httpd-vhosts.conf file for that), you’re using port 443.

What I was referring to was the pair of crypto files that Apache needs to setup the secure server. Unfortunately, I’m a lazy {whatever} and don’t bother do that on my test server; I use cPanel on the production server for the secure server setup.

Regards,

DK

Actually I’m not using 443. Someone else attempted to do this but they no longer work here and I’m cleaning up the mess. All urls for my application on this server are accessed by specifiying port 7777 or 7778 explicitly in the url. That directory where the .htaccess file was found is not part of my application and I have removed it. By the way this is an old version of apache. I can’t get an exact version number thanks to Oracle:


Server version: Oracle-Application-Server-10g/10.1.2.3.0 Oracle-HTTP-Server
Server built:   Apr  2 2009 15:56:58

David, also I have discovered that it’s not just error code 500 that displays its own page but also 404. If I test out a code like 501 it displays my error page properly.

HG,

Questions about an Oracle server in the Apache forum? Hmmm.

Oh, well, if you expect to have your website serve requests, it must respond to the ports which are receiving the requests, i.e., port 80 and 443. Of course, you can “hide” your server by using other ports (typically 8080 and … well, I have no idea what non-standard port would be used for SSL).

From your description of the “mess” and apparent lack of knowledge about your server, I would recommend that you remove the existing server and replace it with a current version of Apache. Because Apache needs to be “hardened,” I would recommend that a sysadmin be used to do this for you (I am very familiar with Apache but do not feel up to sysadmin level - there’s just so much there which needs to be done correctly).

Okay, I don’t feel like I’m being much help here - sorry - but the responses are to your direct questions and are my best suggestions … assuming an Apache server, of course.

Regards,

DK

Believe me dk, If I had my way we would sure start over with something different and more current. Unfortunately there’s not much I can do about that for reasons I really can’t get into. But from my experience with Apache I’m pretty sure that what I’m seeing is a configuration issue somewhere so that’s why I asked here. It’s very suspicious that only certain error codes don’t work with my error page handler.

HG,

I understand (and expected) the limit imposed by your situation and can only offer my condolences.

Please confirm that your .htaccess is simply:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{SERVER_PORT} !443
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L]

Then, please confirm your ports for http and https (obviously, port 443 is used in the code above so, if your https port is not 443, this will never complete - Apache would opt out of the loop after 10 cycles but Oracle obviously does not).

Finally, Advice Redux: In an attempt to sort out the mess, you’ve got to determine where the problem is. Since you’ve narrowed it down to the .htaccess (as a possibility, if nothing else), then comment out the whole thing and run your test URI (on the desired URI of your redirection). If there is no problem (i.e., the file exists and displays properly), then sequentially remove the comment tags (#'s) until an error is presented to you. That last UNCOMMENT uncovered the error.

If you have other code in your .htaccess, you may need to show your test URI’s, too.

Regards,

DK