SHARE
Facebook X Pinterest WhatsApp

Filtering I/O in Apache 2.0: Part 2 Page 4

Written By
thumbnail Ryan Bloom
Ryan Bloom
Oct 23, 2000
ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More



All we have left to do now, is re-compile the server with our new
module and set it up to use the header and footer module.
In this case, adding the filter to the filter chain is best done in the config
file with the AddOutputFilter directive which is defined by the core. Edit your
config file and find the Directory stanza for the directory you wish to add a
header or footer to. The AddOutputFilter directive takes the name of the filter
to add as its argument. In this case it is HEADERFOOTER. As long as we are here,
let’s also add two lines to add a header and footer file to the files in this
directory. Be careful when adding a header and footer to a page. If you add a
header file to a whole directory, and the header file is in that directory, then
your server will recursively send the header file forever. In the configuration
below, we are only adding the header and footer for the index page.


    AddOutputFilter HEADERFOOTER
    
        HeaderFile header
        HeaderText "This is a header text"
        FooterFile footer
        FooterText "This is a footer text"
    

That was a very basic introduction to output filtering. Next month, we continue
looking into Apache 2.0's filtering with input filtering. This will allow your
module to modify the data that a browser sends on a POST or PUT request. I should
also mention here that filtering is still evolving. This module works with
Apache as it is right now. This module has not been tested with any of the
official alpha releases of 2.0, but with slight modifications, it should work with
any of the alphas after alpha 7.

You can download the mod_hf.c file here.

thumbnail Ryan Bloom

Ryan Bloom is a ServerWatch contributor.

Recommended for you...

What Is a Container? Understanding Containerization
What Is a Print Server? | How It Works and What It Does
Nisar Ahmad
Dec 8, 2023
6 Best Linux Virtualization Software for 2024
What Is a Network Policy Server (NPS)? | Essential Guide
ServerWatch Logo

ServerWatch is a top resource on servers. Explore the latest news, reviews and guides for server administrators now.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.