You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Chaitanya Govande <ch...@gmail.com> on 2018/05/02 16:29:36 UTC

[users@httpd] Apache FilterProvider Deflate expression

Hello all,

I am trying to inflate, substitute, and then deflate the content
returned to the client based on the response header. The inflate,
substitute are working as i was able to test these out in isolation.

Here is the code:

FilterDeclare FilterInflate CONTENT_SET
FilterProvider FilterInflate INFLATE "%{CONTENT_TYPE} =~ m|^text/html|
&& %{resp:Content-Encoding} = 'gzip'"

FilterDeclare FilterSub CONTENT_SET
FilterProvider FilterSub SUBSTITUTE "%{CONTENT_TYPE} =~ m|^text/html|"
FilterProtocol FilterSub "change=yes"

FilterDeclare FilterDeflate CONTENT_SET
FilterProvider FilterDeflate DEFLATE "%{CONTENT_TYPE} =~ m|^text/html|
&& %{resp:Content-Encoding} = 'gzip'"
FilterProtocol FilterDeflate "change=yes"

And then later on in the file:

<Location "/">
FilterChain FilterInflate +FilterSub +FilterDeflate
</Location>

The deflate does not seem to work as when I review the chrome dev
tools, I don't see the 'Content-Encoding' header. If I remove the
second condition (%{resp:Content-Encoding} = 'gzip'), it seems to work
properly. However, I have that condition also in the Inflate
FilterProvider and it seems to work there.

No errors in the error.log or anything in the access.log. I have not
included the Substitute code as that is not relevant to the problem.

Any help is appreciated.

Thank you very much!

-- 
Chaitanya Govande

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


Re: [users@httpd] Apache FilterProvider Deflate expression

Posted by Chaitanya Govande <ch...@gmail.com>.
Is there a flag I can use so that the Content-Encoding header is not
removed or set an environment variable if inflate was run or if
Content-Encoding header was removed?

Looked around but did not find much to accomplish the above.

Thank you,
Chaitanya

On Wed, May 2, 2018 at 5:33 PM, Chaitanya Govande <ch...@gmail.com> wrote:
> The content comes from some app server (could be WebSphere or
> WebLogic). From what I read, the SetEnvIf doesn't have access to
> response headers as it is run before?
>
> Sorry, but what is the one-line change to mod_deflate you are referring to?
>
> Thank you,
> Chaitanya
>
> On Wed, May 2, 2018 at 4:26 PM, Nick Kew <ni...@apache.org> wrote:
>>
>>> On 2 May 2018, at 21:24, Chaitanya Govande <ch...@gmail.com> wrote:
>>>
>>> Is there a way to do this then? Can I store a env variable if the
>>> Content-Encoding is gzip and use this variable later in execution for
>>> Deflate?
>>
>> Depends where the contents come from.  See for example SetEnvIf.
>>
>> Alternatives: get the content generator to add a custom header, or
>> a one-line change to mod_deflate to set a flag.
>>
>> —
>> Nick Kew
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>
>
>
> --
> Chaitanya Govande
> 847-387-0546



-- 
Chaitanya Govande
847-387-0546

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


Re: [users@httpd] Apache FilterProvider Deflate expression

Posted by Chaitanya Govande <ch...@gmail.com>.
The content comes from some app server (could be WebSphere or
WebLogic). From what I read, the SetEnvIf doesn't have access to
response headers as it is run before?

Sorry, but what is the one-line change to mod_deflate you are referring to?

Thank you,
Chaitanya

On Wed, May 2, 2018 at 4:26 PM, Nick Kew <ni...@apache.org> wrote:
>
>> On 2 May 2018, at 21:24, Chaitanya Govande <ch...@gmail.com> wrote:
>>
>> Is there a way to do this then? Can I store a env variable if the
>> Content-Encoding is gzip and use this variable later in execution for
>> Deflate?
>
> Depends where the contents come from.  See for example SetEnvIf.
>
> Alternatives: get the content generator to add a custom header, or
> a one-line change to mod_deflate to set a flag.
>
> —
> Nick Kew
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>



-- 
Chaitanya Govande
847-387-0546

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


Re: [users@httpd] Apache FilterProvider Deflate expression

Posted by Nick Kew <ni...@apache.org>.
> On 2 May 2018, at 21:24, Chaitanya Govande <ch...@gmail.com> wrote:
> 
> Is there a way to do this then? Can I store a env variable if the
> Content-Encoding is gzip and use this variable later in execution for
> Deflate?

Depends where the contents come from.  See for example SetEnvIf.

Alternatives: get the content generator to add a custom header, or
a one-line change to mod_deflate to set a flag.

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


Re: [users@httpd] Apache FilterProvider Deflate expression

Posted by Chaitanya Govande <ch...@gmail.com>.
Is there a way to do this then? Can I store a env variable if the
Content-Encoding is gzip and use this variable later in execution for
Deflate?

Any other way? I am trying to inflate, substitute and again deflate if
the original content is gziped but if the original content is not
gziped, then simply substitute.

Thanks,

On Wed, May 2, 2018 at 1:21 PM, Nick Kew <ni...@apache.org> wrote:
> On Wed, 2 May 2018 11:29:36 -0500
> Chaitanya Govande <ch...@gmail.com> wrote:
>
>
>> The deflate does not seem to work as when I review the chrome dev
>> tools, I don't see the 'Content-Encoding' header. If I remove the
>> second condition (%{resp:Content-Encoding} = 'gzip'), it seems to work
>> properly. However, I have that condition also in the Inflate
>> FilterProvider and it seems to work there.
>
> Yep.  When you decompress the contents, it's no longer gzipped,
> so the inflate filter removes the header labelling it as such.
>
> --
> Nick Kew
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>



-- 
Chaitanya Govande
847-387-0546

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


Re: [users@httpd] Apache FilterProvider Deflate expression

Posted by Nick Kew <ni...@apache.org>.
On Wed, 2 May 2018 11:29:36 -0500
Chaitanya Govande <ch...@gmail.com> wrote:


> The deflate does not seem to work as when I review the chrome dev
> tools, I don't see the 'Content-Encoding' header. If I remove the
> second condition (%{resp:Content-Encoding} = 'gzip'), it seems to work
> properly. However, I have that condition also in the Inflate
> FilterProvider and it seems to work there.

Yep.  When you decompress the contents, it's no longer gzipped,
so the inflate filter removes the header labelling it as such.

-- 
Nick Kew

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