You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by Philip Mak <pm...@aaanime.net> on 2001/06/08 21:34:45 UTC

How does $Response->{Status} work?

I'm having problems getting $Response->{Status} to work in conjunction
with ErrorDocument.

I have the following RewriteRule in my httpd.conf:

RewriteRule ^/fanfics/([a-zA-Z_0-9\-]+)/$ /fanfics/series.asp?series=$1

That is, if someone goes to the URL /fanfics/xxx/, it is interpreted as
/fanfics/series.asp?series=xxx.

I want series.asp to return a "404 Not Found" error if it gets an invalid
$series. Right now I have:

unless (series is valid) {
  $Response->{Status} = 404;
}

That returns the "404 Not Found" error correctly, but it also says:

Additionally, a 404 Not Found error was encountered while trying to use an
ErrorDocument to handle the request.

If I call an invalid URL (one that does not pass through series.asp), then
the ErrorDocument works fine.

Suggestions?

-Philip Mak (pmak@aaanime.net)


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: How does $Response->{Status} work?

Posted by Joshua Chamas <jo...@chamas.com>.
Philip Mak wrote:
> 
> I want series.asp to return a "404 Not Found" error if it gets an invalid
> $series. Right now I have:
> 
> unless (series is valid) {
>   $Response->{Status} = 404;
> }
> 
> That returns the "404 Not Found" error correctly, but it also says:
> 
> Additionally, a 404 Not Found error was encountered while trying to use an
> ErrorDocument to handle the request.
> 
> If I call an invalid URL (one that does not pass through series.asp), then
> the ErrorDocument works fine.
> 

I get this kind of error when my ErrorDocument is not properly 
defined.  I'm not sure why it would work fine when you type in 
a real 404 URL, versus setting the 404 status.

Does your access log, error log, or the source of the 404 message 
give any hint as to what ErrorDocument is trying to be found
that is failing?

If all else fails, you may try the $Response->ErrorDocument API
which can help explicity set the 404 error message?

       $Response->ErrorDocument($code, $uri)
            API extension that allows for the modification the
            Apache ErrorDocument at runtime.  $uri may be a on
            site document, off site URL, or string containing the
            error message.

-- Josh

_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks <- Web Link Checking          Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org