You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by ho...@post.cz on 2021/07/13 15:09:41 UTC

[users@httpd] mod_deflate: disable input filter for certain requests

Hello,

I've got SetInputFilter DEFLATE set for the whole virtual host and it works 
fine.




However now I need to disable this input filter for certain requests because
there are some issues with those (I don't want to go into much detail and 
why it happens is out of my reach anyway so I just have to take it as it is,
the important thing is that the backend can process these "unusual" requests
just fine).




Is there any way how to disable it based on certain conditions? Like the no-
gzip environment variable, but for the opposite direction.




I'd use mod_rewrite to determine these conditions (there are few of them) 
and handle those requests differently.





Best regards,

Petr

Re: [users@httpd] mod_deflate: disable input filter for certain requests

Posted by ho...@post.cz.
Hello,

alright. I think I managed to get some acceptable configuration in the 
meantime.




Instead of a global SetInputFilter I used a combination of the LocationMatch
with a negative lookahead regex and the nested If directive with a negated 
expression to define when not to use the deflate input filter.




It seems to work acceptably (though the config is a little clunky to my 
liking).




The Content-Range workaround may work too though (if the backend doesn't 
complain).




Best regards,

Petr




---------- Original message ----------
From: Eric Covener <co...@gmail.com>
To: users@httpd.apache.org
Sent: 13. 7. 2021 20:35:00
Subject: Re: [users@httpd] mod_deflate: disable input filter for certain 
requests 
"On Tue, Jul 13, 2021 at 2:19 PM <ho...@post.cz> wrote: 
> 
> Hello, 
> thanks for the suggestion. 
> 
> It looks like it could be generally doable, however as I understand it 
only output filters can be configured that way. There doesn't seem to be 
anything about input filters in the mod_filter docs. Or am I wrong? If yes 
how to use that approach with input filters then? 

Sorry, it looks like you're right. 

The only two places where the deflate input filter bails out is when 
it sees request headers Content-Range or a Content-Encoding that 
doesn't end with gzip. 
Funny enough, it looks like Content-Range is not really used on 
requests, maybe whatever processes your input will ignore it and you 
can add it dynamically? 

--------------------------------------------------------------------- 
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org 
For additional commands, e-mail: users-help@httpd.apache.org 

"

Re: [users@httpd] mod_deflate: disable input filter for certain requests

Posted by Eric Covener <co...@gmail.com>.
On Tue, Jul 13, 2021 at 2:19 PM <ho...@post.cz> wrote:
>
> Hello,
> thanks for the suggestion.
>
> It looks like it could be generally doable, however as I understand it only output filters can be configured that way. There doesn't seem to be anything about input filters in the mod_filter docs. Or am I wrong? If yes how to use that approach with input filters then?

Sorry, it looks like you're right.

The only two places where the deflate input filter bails out is when
it sees request headers Content-Range or a Content-Encoding that
doesn't end with gzip.
Funny enough, it looks like Content-Range is not really used on
requests, maybe whatever processes your input will ignore it and you
can add it dynamically?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_deflate: disable input filter for certain requests

Posted by ho...@post.cz.
Hello,

thanks for the suggestion.




It looks like it could be generally doable, however as I understand it only 
output filters can be configured that way. There doesn't seem to be anything
about input filters in the mod_filter docs. Or am I wrong? If yes how to use
that approach with input filters then?




Best regards,

Petr




---------- Original message ----------
From: Eric Covener <co...@gmail.com>
To: users@httpd.apache.org
Sent: 13. 7. 2021 17:56:27
Subject: Re: [users@httpd] mod_deflate: disable input filter for certain 
requests 
"On Tue, Jul 13, 2021 at 11:10 AM <ho...@post.cz> wrote: 
> 
> Hello, 
> I've got SetInputFilter DEFLATE set for the whole virtual host and it 
works fine. 
> 
> However now I need to disable this input filter for certain requests 
because there are some issues with those (I don't want to go into much 
detail and why it happens is out of my reach anyway so I just have to take 
it as it is, the important thing is that the backend can process these 
"unusual" requests just fine). 
> 
> Is there any way how to disable it based on certain conditions? Like the 
no-gzip environment variable, but for the opposite direction. 
> 
> I'd use mod_rewrite to determine these conditions (there are few of them) 
and handle those requests differently. 

It doesn't look like there is anything that simple. 

But you could try wrapping it in a mod_filter "smart filter" which can 
be conditionally added based on an expression. You may need to move 
your rules into the expression there or SetEnvIf to have them set 
early enough for the expression argument to see them. 

--------------------------------------------------------------------- 
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org 
For additional commands, e-mail: users-help@httpd.apache.org 

"

Re: [users@httpd] mod_deflate: disable input filter for certain requests

Posted by Eric Covener <co...@gmail.com>.
On Tue, Jul 13, 2021 at 11:10 AM <ho...@post.cz> wrote:
>
> Hello,
> I've got SetInputFilter DEFLATE set for the whole virtual host and it works fine.
>
> However now I need to disable this input filter for certain requests because there are some issues with those (I don't want to go into much detail and why it happens is out of my reach anyway so I just have to take it as it is, the important thing is that the backend can process these "unusual" requests just fine).
>
> Is there any way how to disable it based on certain conditions? Like the no-gzip environment variable, but for the opposite direction.
>
> I'd use mod_rewrite to determine these conditions (there are few of them) and handle those requests differently.

It doesn't look like there is anything that simple.

But you could try wrapping it in a mod_filter "smart filter" which can
be conditionally added based on an expression.  You may need to move
your rules into the expression there or SetEnvIf to have them set
early enough for the expression argument to see them.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org