What error is this, and can Apache reroute it?

This is a discussion on What error is this, and can Apache reroute it? within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi All, I have Apache reroute specific errors to my custom pages, such as 404, 500 errors, etc. But how ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-18-2007
SergioQ
 
Posts: n/a
Default What error is this, and can Apache reroute it?

Hi All,

I have Apache reroute specific errors to my custom pages, such as 404,
500 errors, etc. But how about one that comes up when Perl cannot
compile the script being called. For instance I made a script that
wouldn't compile on pupose, and Apache sends this to the browser:

Software error:
Global symbol "%XEmailMsg" requires explicit package name at
make_error.pl line 8.
Execution of make_error.pl aborted due to compilation errors.

Surely this is a type of error, and I could send Apache to a custom
page?

Thanks ahead.

  #2 (permalink)  
Old 01-18-2007
shimmyshack
 
Posts: n/a
Default Re: What error is this, and can Apache reroute it?


SergioQ wrote:
> Hi All,
>
> I have Apache reroute specific errors to my custom pages, such as 404,
> 500 errors, etc. But how about one that comes up when Perl cannot
> compile the script being called. For instance I made a script that
> wouldn't compile on pupose, and Apache sends this to the browser:
>
> Software error:
> Global symbol "%XEmailMsg" requires explicit package name at
> make_error.pl line 8.
> Execution of make_error.pl aborted due to compilation errors.
>
> Surely this is a type of error, and I could send Apache to a custom
> page?
>
> Thanks ahead.


is it coming from apache though, if it is coming from the perl
interpreter you have to have a filtering rule set up to filter by
likely "error" words in the body of the outgoing response, unless you
implement a custom error handler within all your scripts that will fail
and only output the errors after the 500 reponse has been sent.
Since you wish to redirect your users to an error page I am assuming
that you want the errors to still be output from your scripts, most
people turn off such things because they lead to path traversal attacks
and info disclosure.

However yes you can do what you are asking for, go grab mod_security
and set up the filtering there to wathc for the words
"Software error:" or "aborted sue to compilation errors"

heres something i had in my httpd-modsecurityconf file (for php errors
which were redirected to a "nice dump page" while some software I was
working on was in dev

##Filter out fatal php errors so they never reach the user, instead
report them using a custom script
#mod2installed SecFilterSelective OUTPUT "Fatal error:"
"deny,status:403"
#ErrorDocument 500 /blah/php/php-fatal-error.htm

I stopped using it I think because of body response bufferring or just
the overhead I forget which, check the docs for mod_security and good
luck

  #3 (permalink)  
Old 01-18-2007
HansH
 
Posts: n/a
Default Re: What error is this, and can Apache reroute it?

"SergioQ" <sergio@warptv.com> schreef in bericht
news:1169137408.135535.77690@q2g2000cwa.googlegrou ps.com...
> ...For instance I made a script that
> wouldn't compile on pupose, and Apache sends this to the browser:
>
> Software error:
> Global symbol "%XEmailMsg" requires explicit package name at
> make_error.pl line 8.
> Execution of make_error.pl aborted due to compilation errors.
>

AFAIK that's not Apache barking, it's Perl made to bark by the use of both
strict and CGI::Carp ...The latter is causing your script to generate output
-not yours though- and Apache only takes NO output for an error

Consider conditional require instead based on your IP(range),like
#!/usr/bin/perl

use strict;

BEGIN {
if( $ENV{'REMOTE_ADDR'} =~ /^192\./o ) {
require CGI::Carp;
import CGI::Carp qw(fatalsToBrowser warningsToBrowser);
}
}
END{
if( $ENV{'REMOTE_ADDR'} =~ /^192\./o ) {
eval{ warningsToBrowser(1) };
}
}

$test='test'; # undeclared var

$_ =$_/$_; # devide by 0 ..

#EoD

HansH


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:29 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0