You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Brian Mearns <bm...@ieee.org> on 2009/11/04 15:39:02 UTC

[users@httpd] Conditional behavior by status code

Is there any way to get Apache to behave differently based on the
status code, specifically apply different OutputFilters? This is
similar in concept, I believe, to AddOutputFilterByType, which relies
on the generated Content-Type header to determine what filter to
apply. But I want to apply different filters based on the status code.
If there is any way to set an environment variable based on the status
code, that would work as well.

Thanks,
-Brian

-- 
Feel free to contact me using PGP Encryption:
Key Id: 0x3AA70848
Available from: http://keys.gnupg.net

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Conditional behavior by status code

Posted by Brian Mearns <me...@gmail.com>.
On Wed, Nov 4, 2009 at 4:23 PM, Nick Kew <ni...@webthing.com> wrote:
>
>>> Is there any way to get Apache to behave differently based on the
>>> status code, specifically apply different OutputFilters? This is
>
> With httpd-2.3/2.4, just make that a condition for FilterProvider.
>
> With 2.2, condition evaluation is more limited so you can't do that.
> It would be a fairly trivial hack to mod_filter, or you could make
> the check within your filter itself.

Okay, I am currently using 2.2, but maybe I'll think about upgrading.
If my filter wasn't an external, I would probably just check in there,
as you said. But it is an external filter...I don't think I have
access to the status code at all, right?

>>  If you want to serve a different page depending upon the status, there is
>> the ErrorDocument directive.
>
> That's fine if it is an errordocument coming from the server itself,
> but not useful if it's from some application.
[clip]

Right, this has nothing to do with error responses. As I mentioned in
the original post, I want to control filter behavior based on the
response code. Specifically, I just want to skip a bunch of processing
filters for 304 Not Modified responses.

-Brian

-- 
Feel free to contact me using PGP Encryption:
Key Id: 0x3AA70848
Available from: http://keys.gnupg.net

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Conditional behavior by status code

Posted by Nick Kew <ni...@webthing.com>.
>> Is there any way to get Apache to behave differently based on the
>> status code, specifically apply different OutputFilters? This is

With httpd-2.3/2.4, just make that a condition for FilterProvider.

With 2.2, condition evaluation is more limited so you can't do that.
It would be a fairly trivial hack to mod_filter, or you could make
the check within your filter itself.

>   If you want to serve a different page depending upon the status, there is
> the ErrorDocument directive.

That's fine if it is an errordocument coming from the server itself,
but not useful if it's from some application.

-- 
Nick Kew

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Conditional behavior by status code

Posted by Sean Conner <sp...@conman.org>.
It was thus said that the Great Brian Mearns once stated:
> Is there any way to get Apache to behave differently based on the
> status code, specifically apply different OutputFilters? This is
> similar in concept, I believe, to AddOutputFilterByType, which relies
> on the generated Content-Type header to determine what filter to
> apply. But I want to apply different filters based on the status code.
> If there is any way to set an environment variable based on the status
> code, that would work as well.

  If you want to serve a different page depending upon the status, there is
the ErrorDocument directive.

  -spc


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org