Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Users

Conditional behavior by status code

 

 

Apache users RSS feed   Index | Next | Previous | View Threaded


bmearns at ieee

Nov 4, 2009, 6:39 AM

Post #1 of 4 (143 views)
Permalink
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[at]httpd.apache.org
" from the digest: users-digest-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: users-help[at]httpd.apache.org


spc at conman

Nov 4, 2009, 12:56 PM

Post #2 of 4 (132 views)
Permalink
Re: Conditional behavior by status code [In reply to]

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[at]httpd.apache.org
" from the digest: users-digest-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: users-help[at]httpd.apache.org


nick at webthing

Nov 4, 2009, 1:23 PM

Post #3 of 4 (132 views)
Permalink
Re: Conditional behavior by status code [In reply to]

>> 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[at]httpd.apache.org
" from the digest: users-digest-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: users-help[at]httpd.apache.org


mearns.b at gmail

Nov 5, 2009, 6:22 AM

Post #4 of 4 (122 views)
Permalink
Re: Conditional behavior by status code [In reply to]

On Wed, Nov 4, 2009 at 4:23 PM, Nick Kew <nick[at]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[at]httpd.apache.org
" from the digest: users-digest-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: users-help[at]httpd.apache.org

Apache users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.