Blame docs/manual/filter.html.en

Packit 90a5c9
Packit 90a5c9
Packit 90a5c9
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
Packit 90a5c9
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
Packit 90a5c9
Packit 90a5c9
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Packit 90a5c9
              This file is generated from xml source: DO NOT EDIT
Packit 90a5c9
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Packit 90a5c9
      -->
Packit 90a5c9
<title>Filters - Apache HTTP Server Version 2.4</title>
Packit 90a5c9
<link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
Packit 90a5c9
<link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
Packit 90a5c9
<link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="./style/css/prettify.css" />
Packit 90a5c9
<script src="./style/scripts/prettify.min.js" type="text/javascript">
Packit 90a5c9
</script>
Packit 90a5c9
Packit 90a5c9
<link href="./images/favicon.ico" rel="shortcut icon" /></head>
Packit 90a5c9
<body id="manual-page">
Packit 90a5c9

Modules | Directives | FAQ | Glossary | Sitemap

Packit 90a5c9

Apache HTTP Server Version 2.4

Packit 90a5c9
Packit 90a5c9
<-
Packit 90a5c9
Packit 90a5c9
Apache > HTTP Server > Documentation > Version 2.4

Filters

Packit 90a5c9
Packit 90a5c9

Available Languages:  en  |

Packit 90a5c9
 es  |
Packit 90a5c9
 fr  |
Packit 90a5c9
 ja  |
Packit 90a5c9
 ko  |
Packit 90a5c9
 tr 

Packit 90a5c9
Packit 90a5c9
Packit 90a5c9
    

This document describes the use of filters in Apache.

Packit 90a5c9
  
Packit 90a5c9
Packit 90a5c9
  • Smart Filtering
  • Packit 90a5c9
  • Exposing Filters as an HTTP Service
  • Packit 90a5c9
  • Using Filters
  • Packit 90a5c9

    See also

    Packit 90a5c9
    top
    Packit 90a5c9
    Packit 90a5c9

    Filtering in Apache 2

    Packit 90a5c9
        
    Packit 90a5c9
        
    Packit 90a5c9
    Packit 90a5c9

    The Filter Chain is available in Apache 2.0 and higher,

    Packit 90a5c9
    and enables applications to process incoming and outgoing data
    Packit 90a5c9
    in a highly flexible and configurable manner, regardless of
    Packit 90a5c9
    where the data comes from.  We can pre-process incoming data,
    Packit 90a5c9
    and post-process outgoing data, at will.  This is basically
    Packit 90a5c9
    independent of the traditional request processing phases.

    Packit 90a5c9

    Packit 90a5c9
    Filters can be chained, in a Data Axis orthogonal to request processing
    Packit 90a5c9

    Packit 90a5c9

    Some examples of filtering in the standard Apache distribution are:

    Packit 90a5c9
      Packit 90a5c9
    • mod_include, implements server-side includes.
    • Packit 90a5c9
    • mod_ssl, implements SSL encryption (https).
    • Packit 90a5c9
    • mod_deflate, implements compression/decompression on the fly.
    • Packit 90a5c9
    • mod_charset_lite, transcodes between different character sets.
    • Packit 90a5c9
    • mod_ext_filter, runs an external program as a filter.
    • Packit 90a5c9
      Packit 90a5c9

      Apache also uses a number of filters internally to perform

      Packit 90a5c9
      functions like chunking and byte-range handling.

      Packit 90a5c9
      Packit 90a5c9

      A wider range of applications are implemented by third-party filter

      Packit 90a5c9
      modules available from modules.apache.org and
      Packit 90a5c9
      elsewhere.  A few of these are:

      Packit 90a5c9
      Packit 90a5c9
        Packit 90a5c9
      • HTML and XML processing and rewriting
      • Packit 90a5c9
      • XSLT transforms and XIncludes
      • Packit 90a5c9
      • XML Namespace support
      • Packit 90a5c9
      • File Upload handling and decoding of HTML Forms
      • Packit 90a5c9
      • Image processing
      • Packit 90a5c9
      • Protection of vulnerable applications such as PHP scripts
      • Packit 90a5c9
      • Text search-and-replace editing
      • Packit 90a5c9
        Packit 90a5c9
        top
        Packit 90a5c9
        Packit 90a5c9

        Smart Filtering

        Packit 90a5c9
        Packit 90a5c9

        Packit 90a5c9
        Smart filtering applies different filter providers according to the state of request processing
        Packit 90a5c9

        Packit 90a5c9

        mod_filter, included in Apache 2.1 and later,

        Packit 90a5c9
        enables the filter chain to be configured dynamically at run time.
        Packit 90a5c9
        So for example you can set up a proxy to rewrite
        Packit 90a5c9
        HTML with an HTML filter and JPEG images with a completely
        Packit 90a5c9
        separate filter, despite the proxy having no prior information
        Packit 90a5c9
        about what the origin server will send.  This works by using a
        Packit 90a5c9
        filter harness, that dispatches to different providers according
        Packit 90a5c9
        to the actual contents at runtime.  Any filter may be either
        Packit 90a5c9
        inserted directly in the chain and run unconditionally, or
        Packit 90a5c9
        used as a provider and inserted dynamically.  For example,

        Packit 90a5c9
          Packit 90a5c9
        • an HTML processing filter will only run if the content is
        • Packit 90a5c9
          text/html or application/xhtml+xml
          Packit 90a5c9
        • A compression filter will only run if the input is a
        • Packit 90a5c9
          compressible type and not already compressed
          Packit 90a5c9
        • A charset conversion filter will be inserted if a text
        • Packit 90a5c9
          document is not already in the desired charset
          Packit 90a5c9
          Packit 90a5c9
          top
          Packit 90a5c9
          Packit 90a5c9

          Exposing Filters as an HTTP Service

          Packit 90a5c9
          Packit 90a5c9
          Packit 90a5c9

          Filters can be used to process content originating from the client in

          Packit 90a5c9
          addition to processing content originating on the server using the
          Packit 90a5c9
          mod_reflector module.

          Packit 90a5c9
          Packit 90a5c9

          mod_reflector accepts POST requests from clients, and reflects

          Packit 90a5c9
          the content request body received within the POST request back in the response,
          Packit 90a5c9
          passing through the output filter stack on the way back to the client.

          Packit 90a5c9
          Packit 90a5c9

          This technique can be used as an alternative to a web service running within

          Packit 90a5c9
          an application server stack, where an output filter provides the transformation
          Packit 90a5c9
          required on the request body. For example, the mod_deflate
          Packit 90a5c9
          module might be used to provide a general compression service, or an image
          Packit 90a5c9
          transformation filter might be turned into an image transformation service.

          Packit 90a5c9
          Packit 90a5c9
          top
          Packit 90a5c9
          Packit 90a5c9

          Using Filters

          Packit 90a5c9
          Packit 90a5c9

          There are two ways to use filtering: Simple and Dynamic.

          Packit 90a5c9
          In general, you should use one or the other; mixing them can
          Packit 90a5c9
          have unexpected consequences (although simple Input filtering
          Packit 90a5c9
          can be mixed freely with either simple or dynamic Output filtering).

          Packit 90a5c9

          The Simple Way is the only way to configure input filters, and is

          Packit 90a5c9
          sufficient for output filters where you need a static filter chain.
          Packit 90a5c9
          Relevant directives are
          Packit 90a5c9
              SetInputFilter,
          Packit 90a5c9
              SetOutputFilter,
          Packit 90a5c9
              AddInputFilter,
          Packit 90a5c9
              AddOutputFilter,
          Packit 90a5c9
              RemoveInputFilter, and
          Packit 90a5c9
              RemoveOutputFilter.

          Packit 90a5c9
          Packit 90a5c9

          The Dynamic Way enables both static and flexible, dynamic configuration

          Packit 90a5c9
          of output filters, as discussed in the mod_filter page.
          Packit 90a5c9
          Relevant directives are
          Packit 90a5c9
              FilterChain,
          Packit 90a5c9
              FilterDeclare, and
          Packit 90a5c9
              FilterProvider.

          Packit 90a5c9
          Packit 90a5c9

          One further directive AddOutputFilterByType is still supported,

          Packit 90a5c9
          but deprecated.  Use dynamic configuration instead.

          Packit 90a5c9
          Packit 90a5c9
            
          Packit 90a5c9
          Packit 90a5c9

          Available Languages:  en  |

          Packit 90a5c9
           es  |
          Packit 90a5c9
           fr  |
          Packit 90a5c9
           ja  |
          Packit 90a5c9
           ko  |
          Packit 90a5c9
           tr 

          Packit 90a5c9
          top

          Comments

          Notice:
          This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our mailing lists.
          Packit 90a5c9
          <script type="text/javascript">
          Packit 90a5c9
          var comments_shortname = 'httpd';
          Packit 90a5c9
          var comments_identifier = 'http://httpd.apache.org/docs/2.4/filter.html';
          Packit 90a5c9
          (function(w, d) {
          Packit 90a5c9
              if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
          Packit 90a5c9
                  d.write('
          <\/div>');
          Packit 90a5c9
                  var s = d.createElement('script');
          Packit 90a5c9
                  s.type = 'text/javascript';
          Packit 90a5c9
                  s.async = true;
          Packit 90a5c9
                  s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
          Packit 90a5c9
                  (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
          Packit 90a5c9
              }
          Packit 90a5c9
              else { 
          Packit 90a5c9
                  d.write('
          Comments are disabled for this page at the moment.<\/div>');
          Packit 90a5c9
              }
          Packit 90a5c9
          })(window, document);
          Packit 90a5c9
          //--></script>
          Packit 90a5c9

          Copyright 2018 The Apache Software Foundation.
          Licensed under the Apache License, Version 2.0.

          Packit 90a5c9

          Modules | Directives | FAQ | Glossary | Sitemap

          <script type="text/javascript">
          Packit 90a5c9
          if (typeof(prettyPrint) !== 'undefined') {
          Packit 90a5c9
              prettyPrint();
          Packit 90a5c9
          }
          Packit 90a5c9
          //--></script>
          Packit 90a5c9
          </body></html>