~ubuntu-branches/ubuntu/wily/trafficserver/wily

« back to all changes in this revision

Viewing changes to plugins/header_filter/README

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2012-12-17 22:28:16 UTC
  • mfrom: (5.1.8 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20121217222816-7xwjsx5k76zkb63d
Tags: 3.2.0-1ubuntu1
* Revert FreeBSD strerror_r() fixes that give errors with glibc 2.16.
* Apply patch from Konstantinos Margaritis to define barriers on ARM.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Apache Traffic Server Header Filter plugin
 
2
==========================================
 
3
 
 
4
This is a simple plugin for filtering out headers from requests (or
 
5
responses). Typical configuration is done either with a global
 
6
configuration, in .../etc/trafficserver/plugin.config:
 
7
 
 
8
    header_filter.so /usr/local/etc/hdr_filters.conf
 
9
 
 
10
 
 
11
Or, alternatively, in a per-remap rule configuration 
 
12
 
 
13
    map http://a.com/ http://b.com @plugin=header_filter.so @pparam=hdr_filters.conf
 
14
 
 
15
 
 
16
Even if you don't have a global configuration, if your remap rules
 
17
schedules actions in hooks other than during remap, you must also add the
 
18
header_filter.so to the plugin.config (see above), but without args:
 
19
 
 
20
    header_filter.so
 
21
 
 
22
 
 
23
The configuration files looks like
 
24
 
 
25
[READ_REQUEST_HDR]
 
26
        X-From-Someone
 
27
        Cookie
 
28
 
 
29
[READ_RESPONSE_HDR]
 
30
        X-From-Server
 
31
        Set-Cookie
 
32
 
 
33
[SEND_RESPONSE_HDR]
 
34
        X-Fie "Test"    # Match the entire string
 
35
        X-Foo /Test/    # Match the (Perl) regex
 
36
        X-Bar [Test*    # Match the prefix string
 
37
        X-Fum *Test]    # Match the postfix string
 
38
 
 
39
 
 
40
Comments are prefixed with #, and in most cases, the regular expression
 
41
matching is the best choice (very little overhead). The pattern matches
 
42
can also take an option '!' to reverse the test. The default action is
 
43
to delete all headers that do (not) match the pattern. E.g.
 
44
 
 
45
[SEND_REQUEST_HDR]
 
46
        X-Fie   /test/
 
47
        X-Foo ! /test/i
 
48
 
 
49
 
 
50
The final "i" qualifier (works on all pattern matches) forces the match or
 
51
comparison to be made case insensitive (just like in Perl).
 
52
 
 
53
 
 
54
It's also possible to replace or add headers, using the = and +
 
55
operators. For example
 
56
 
 
57
[SEND_REQUEST_HDR]
 
58
        Host =www.example.com=
 
59
        X-Foo +ATS+
 
60
 
 
61
 
 
62
This will force the Host: header to have exactly one value,
 
63
www.example.com, while X-Foo will have at least one header with the value
 
64
ATS, but there could be more instances of the header from the existing
 
65
header in the request.
 
66
 
 
67
 
 
68
Possible hooks are
 
69
 
 
70
         READ_REQUEST_HDR
 
71
         SEND_REQUEST_HDR
 
72
         READ_RESPONSE_HDR
 
73
         SEND_RESPONSE_HDR
 
74
 
 
75
 
 
76
If not specified, the default hook to add the rules (headers to filter) is
 
77
READ_REQUEST_HDR. It's completely acceptable (and useful) to configure a
 
78
remap rule to delete headers in a later hook (e.g. when reading a response
 
79
from the server). This is what actually makes the plugin even remotely
 
80
useful.
 
81
 
 
82
 
 
83
 
 
84
BUILDING
 
85
========
 
86
 
 
87
A simple
 
88
 
 
89
    % make
 
90
    % make install
 
91
 
 
92
 
 
93
should do it, assuming that you have the tsxs script in your search
 
94
path. This script is installed with your installation of Apache Traffic
 
95
Server.