httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <>
Subject Re: Howto return apache status (error) page from ouptut filter ?
Date Mon, 27 Aug 2007 14:34:40 GMT
On Mon, 27 Aug 2007 16:05:09 +0200
Holger Moser <> wrote:

> Hi,
> To keep a long storry short: i have an apache module that sets an
> ouput-filter (besides other things), does validate/mangle the data. so
> far so good. my question now is how can i get apache to generate an
> errorpage by itself if my module wants it to return with e.g. 404
> errcode (just returning the status code as outputfilter returnvalue
> doesnt work.. i tried that because someone mentioned it could work).
> currently i generate my own errorpage with the statuscode as
> workaround (but this is only a temp solution). so whats the correct
> way doing that?

A filter is the wrong place to set an error status.  Your filter
function is a callback, and in general will be called after the
response status has already been sent to the client.

The exception to that is in the first call to your filter function.
But if you're relying on that, it points to a problem in your
design.  Though in that case, you can still set r->status and
return APR_EGENERAL, and hope the content generator (which is
in control) does what you want.

Nick Kew

Application Development with Apache - the Apache Modules Book

View raw message