> On 24 Jul 2021, at 14:59, sebb <seb...@gmail.com> wrote:
> 
> I'm trying to write a filter to add a banner to some HTML pages.
> 
> I have used the following definition:
> 
> ExtFilterDefine rebootbanner mode=output \
>    intype=text/html outtype=text/html \
>   cmd="add_banner.sh"
> 
> The script contents boil down to:
> 
> echo header
> cat
> echo footer


If they're HTML, that'll break badly!  You'd need to add the header
and footer within the HTML <body>.  Markup-aware filters will do that,
or you could (at fairly low risk) use a sed or regexp search-and-replace filter.

A second consideration is that with ExtFilter you're incurring two performance
penalties.  Spawning an extfilter process (a CGI-equivalent overhead)
and pumping your data through the filter.

> This works fine for some pages, however other pages fail to display in
> a browser.
> Turns out that the issue is that the input to the filter is sometimes gzipped.
> The header causes issues for the browser display.

> How can I ensure that the filter is run before the output is gzipped?

It's many years ago so memory is hazy, but making filtering play nicely
with gzipped contents, particularly in a proxy situation, was one of the
main motivations behind both mod_filter and the INFLATE output filter in
mod_deflate.  Revisiting the documentation I see the image downsampling
example in the mod_filter page applies the same principle (and also dates it -
that was for a proxy accelerator for mobile phones pre-3G).

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

Reply via email to