PDA

View Full Version : 401 ErrorDocument Question


enticy
3-6-04, 10:51 AM
I run a slightly modified version of birdtrap.cgi to catch, report and log errors as well as serve custom error pages.

It works like a champ in the main directory. (had been doing fine for years on the previous host)...

The question is: using sub domains it does not seem to matter what the ErrorDocument points to, it will not work.

Most importantly I need 401 error reporting, instantly via email, which the modified birdtrap does for me, but this box will not allow 401 error catching, in every conceivable path and option i can muster.

So..... can anyone muster a slightly more conceivable concept to fix this issue?

I need 401 error reporting. If a person attempts access to a secure directory I have to know it immediately as I track who they are and where they are from to determine if they have access to the next level.

Thank you in advance.

NMS
3-6-04, 11:02 AM
Check this:

http://help.powweb.com/info/404.php

enticy
3-6-04, 11:21 AM
Yikes pHp

Sorry, couldn't resist... I write perl for a living...

Nice script, but 404 works fine... in everything but sub domains...

its the sub domain issue i'm concerned with, as well as

401...... 401 is the main desire...

NMS
3-6-04, 11:24 AM
If you create an htaccess within that subdomain as per this tutorial - http://help.powweb.com/tutorials/htaccess/customerrors.php, then you can control the errors within subdomains as well

enticy
3-6-04, 11:32 AM
Originally posted by nmsupplies
If you create an htaccess within that subdomain as per this tutorial - http://help.powweb.com/tutorials/htaccess/customerrors.php, then you can control the errors within subdomains as well

Thanks for the link, but it returns an error.

NMS
3-6-04, 11:33 AM
http://help.powweb.com/tutorials/htaccess/customerrors.php

enticy
3-6-04, 11:38 AM
Thank you for the working link, but i've been there already.

Here's the situation...

http://www.enticy.org/ runs birdtrap.cgi (a great error handler, once modified) ...

it reports custom pages for errors and the htaccess file has this in it for the main directory:

ErrorDocument 400 http://www.enticy.org/birdtrap.cgi?400
ErrorDocument 401 http://www.enticy.org/birdtrap.cgi?401
ErrorDocument 403 http://www.enticy.org/birdtrap.cgi?403
ErrorDocument 404 http://www.enticy.org/birdtrap.cgi?404
ErrorDocument 500 http://www.enticy.org/birdtrap.cgi?500

it will not work without the complete URL, which is not a good thing since birdtrap won't report the offending page that way, but it works....

Tried the same set up in a secure directory and the 401 page returns the box's default 401 no authorization content...

snowmaker
3-6-04, 12:50 PM
Are you sure you have edited it correctly? I just installed it, and I'm not using the complete url in the ErrorDocument lines in .htaccess. Make sure the return link url is set correctly, it should be just <i>http://yoursite.com</i>. I put the script in my cgi-bin dir too, not htdocs.

-bruce

well i spoke too soon, can't seem to get to catch 500's, but 404's work..

enticy
3-6-04, 02:23 PM
404's work fine... nothing else seems to want to work at all...

i did try every url combination and still nothing

sub domains ie: something.domainname.ext

do not work at all...

very disconcerting

snowmaker
3-6-04, 02:55 PM
I got it to catch 500 errors, but it will only do that if the cause of the error isn't coming from cgi-bin. This link (http://somdcomputerguy.com/cgi-bin/gm/gm.cgi) will generate powweb's 500 error page, but this link (http://somdcomputerguy.com/weather/hw3.cgi) will show the birdtrap scripts 500 error page.

-bruce

I never thought I'd be hosing my scripts to try and get a 500 error..:eek:

enticy
3-6-04, 03:02 PM
Mine is accepting 500 codes from the main directory and those pointed beyond the main directory, and those inside sub-directories...

the only thing that will not work is authorization required errors

when htaccess serves username password and the response in incorrect after the trys, the authorization required should kick in and be caught as error 401 but it is not.

I have submitted a ticket to support on this issue... perhaps one day i'll hear a nice fix for it

thanks for updating

snowmaker
3-6-04, 03:21 PM
Originally posted by snowmaker
I got it to catch 500 errors, but it will only do that if the cause of the error isn't coming from cgi-bin. This link (http://somdcomputerguy.com/cgi-bin/gm/gm.cgi) will generate powweb's 500 error page, but this link (http://somdcomputerguy.com/weather/hw3.cgi) will show the birdtrap scripts 500 error page.

-bruce

I never thought I'd be hosing my scripts to try and get a 500 error..:eek:

I put a .htaccess with the ErrorDocument directives in it in the cgi-bin and now the script will catch errors from the cgi-bin.

snowmaker
3-6-04, 04:03 PM
Click to this link (http://zina.somdcomputerguy.com), and hit escape to cancel the login prompt. Is this how you're trying to get birdtrap setup? I put a .htaccess file in the zina directory (at htdocs level) to get this to work, like I had to do with cgi-bin too.

-bruce

enticy
3-6-04, 04:55 PM
Yes it is

i'll try the ErrorDocument again in htaccess in the secure directory
and let you know

thanks

enticy
3-6-04, 05:03 PM
Well here it is http://secure.enticy.org

birtrap is in cgi-bin
works well with other than 401

will not show a 401 birdtrap result in the directory

htaccess set to

ErrorDocument 401 http://enticy.org/cgi-bin/birdtrap.cgi?401
plus the other errors
put at the bottom of the htaccess file

What the heck am I doing wrong.....

snowmaker
3-7-04, 04:04 AM
ErrorDocument 401 http://enticy.org/cgi-bin/birdtrap.cgi?401


This only needs to be /cgi-bin/birdtrap, as long as birdtrap.cgi is in /www/u/user/cgi-bin. You also probably need a /www/u/user/secure/.htaccess file, with the errordocument lines. The one in htdocs won't work for subdomains.

-bruce

enticy
3-7-04, 11:36 AM
Originally posted by snowmaker
This only needs to be /cgi-bin/birdtrap, as long as birdtrap.cgi is in /www/u/user/cgi-bin. You also probably need a /www/u/user/secure/.htaccess file, with the errordocument lines. The one in htdocs won't work for subdomains.
-bruce

THANK YOU !!!

the trick was placing the htaccess file in the www/u/user/ directory equal to htdocs and cgi-bin . Sub domains now work. Also trimmed the url's and its reporting the offending file now... thank you very much for your attention to this..

If I can ever be of any help in the future (perl, javascript, physics etc) just buzz me...

Thanks again..
lee

snowmaker
3-7-04, 12:11 PM
Originally posted by enticy
THANK YOU !!!

You bet. -bruce