You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ruud Dozijn <rd...@hotmail.com> on 2012/07/11 11:05:37 UTC

[users@httpd] apache changes status code from 500 to 200

RE: [users@httpd] apache adds extra HTML to an error pageā€Using httpd on redhat 5
Problem: on an non 200 http status code, apache garbles output of web server by adding a default error document and changing the error code to 200. 
When supplying a custom error document or none, the http status is changed to 200.
Thanks to previous help I am a step further in the migration process. The only bottle neck is this error code.Has anyone a clue what this might be. Is there a solution to this anyway, or it a bug?

In httpd.conf I put
ErrorDocument 500 " "
which results in (first line is output of script that performs the request, the rest is the http response):
#<Net::HTTPOK 200 OK readbody=true>
<!DOCTYPE HTML
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>agent</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<BODY>
<P>ERROR</P><P>database lookup failure</P>
</BODY>
</HTML> 
thanks, Ruud
 		 	   		  

RE: [users@httpd] apache changes status code from 500 to 200

Posted by Ruud Dozijn <rd...@hotmail.com>.

> Firstly, it turns out that it isn't a CGI script but rather a mod_perl2
> registry script - different beast entirely. And given that, I'm
> surprised that you aren't using
> 
> 	PerlOptions +ParseHeaders
> 
> as suggested in the docs at
> http://perl.apache.org/docs/2.0/user/intro/start_fast.html#Registry_Scripts
> Perhaps that will provide the functionality which you require.

hi Pete,
too bad, this makes no difference. And if I use an errordocument (which is a registry script with that perloptions set) I get the same result.

I keep getting apache interference:

#<Net::HTTPOK 200 OK readbody=true>
<!DOCTYPE HTML
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>agent</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<BODY>
<P>ERROR</P><P>database lookup failed</P>
</BODY>
</HTML><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>200 OK</title>
</head><body>
<h1>OK</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
 webmaster@sdu.nl and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
</body></html>

Maybe I should stop using error codes to communicate error situation with the receiver... :(
Ruud

 		 	   		  

Re: [users@httpd] apache changes status code from 500 to 200

Posted by Pete Houston <ph...@openstrike.co.uk>.
On Wed, Jul 11, 2012 at 03:21:12PM +0200, Ruud Dozijn wrote:
> 
> I have put this in my httpd.conf:
> 
> <Location /cgi>
>     SetHandler  perl-script
>     PerlHandler ModPerl::Registry
>     Options ExecCGI
>     ErrorDocument 400 /handlers/400.h
> </Location>
> 
> <Location /handlers>
>     SetHandler send-as-is
> </Location>
> 
> 
> What I would really like to obtain is that the output of my cgi script (being a complete html document including headers) is not handled by any error handler. 

Firstly, it turns out that it isn't a CGI script but rather a mod_perl2
registry script - different beast entirely. And given that, I'm
surprised that you aren't using

	PerlOptions +ParseHeaders

as suggested in the docs at
http://perl.apache.org/docs/2.0/user/intro/start_fast.html#Registry_Scripts
Perhaps that will provide the functionality which you require.

Pete
-- 
Openstrike - improving business through open source
http://www.openstrike.co.uk/ or call 01722 770036 / 07092 020107

RE: [users@httpd] apache changes status code from 500 to 200

Posted by Ruud Dozijn <rd...@hotmail.com>.


From: rdozijn@hotmail.com
To: users@httpd.apache.org
Date: Wed, 11 Jul 2012 12:33:49 +0200
Subject: RE: [users@httpd] apache changes status code from 500 to 200





> Sounds like you want mod_asis:
> http://httpd.apache.org/docs/2.4/mod/mod_asis.html


I have put this in my httpd.conf:

<Location /cgi>
    SetHandler  perl-script
    PerlHandler ModPerl::Registry
    Options ExecCGI
    ErrorDocument 400 /handlers/400.h
</Location>

<Location /handlers>
    SetHandler send-as-is
</Location>


What I would really like to obtain is that the output of my cgi script (being a complete html document including headers) is not handled by any error handler. 
I cannot add the set-as-is hanlder to the cgi script, because that needs the perl-script handler. I suspect that using the ErrorDocument is a dead alley, because that introduces code 200.

In the meantime, I have tried everything I could think of.
Right now, I'm out of ideas. How can I get the status of the cgi-script untampered to the requestor? Hope you have more inspiration ;)

Ruud
 		 	   		   		 	   		  

RE: [users@httpd] apache changes status code from 500 to 200

Posted by Ruud Dozijn <rd...@hotmail.com>.
> Sounds like you want mod_asis:
> http://httpd.apache.org/docs/2.4/mod/mod_asis.html


I have put this in my httpd.conf:

<Location /cgi>
    SetHandler  perl-script
    PerlHandler ModPerl::Registry
    Options ExecCGI
    ErrorDocument 400 /handlers/400.h
</Location>

<Location /handlers>
    SetHandler send-as-is
</Location>

I can see that the mentioned file is used, but still the status is changed to 200. But is was worth trying. It sounded promising....

Thanks, Ruud

 		 	   		  

Re: [users@httpd] apache changes status code from 500 to 200

Posted by Pete Houston <ph...@openstrike.co.uk>.
Sounds like you want mod_asis:
http://httpd.apache.org/docs/2.4/mod/mod_asis.html

Pete
-- 
Openstrike - improving business through open source
http://www.openstrike.co.uk/ or call 01722 770036 / 07092 020107