~titusx/nginx/module-substitutions

« back to all changes in this revision

Viewing changes to README.wiki

  • Committer: Weibin Yao
  • Date: 2010-08-11 08:36:05 UTC
  • mfrom: (10.1.19)
  • Revision ID: git-v1:69c4c8dfe2c82aeabf8d6c5736b134c7dadaeb73
merge from the develop branch, r37


git-svn-id: http://substitutions4nginx.googlecode.com/svn/trunk@38 184bbb60-1f5e-11de-b650-e715bd6d7cf1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
= nginx_substitutions_filter =
 
2
 
 
3
''Note: this module is not distributed with the Nginx source. Installation instructions can be found [[#Installation|below]].''
 
4
 
 
5
== Description ==
 
6
 
 
7
'''nginx_substitutions_filter''' is a filter module which can do both regular expression and fixed string substitutions on response bodies. This module is quite different from the Nginx's native Substitution Module. It scans the output chains buffer and matches string line by line, just like Apache's [http://httpd.apache.org/docs/trunk/mod/mod_substitute.html mod_substitute].
 
8
 
 
9
== Example ==
 
10
 
 
11
<geshi lang="nginx">
 
12
location / {
 
13
 
 
14
    subs_filter_types text/html text/css text/xml;
 
15
    subs_filter st(\d*).example.com $1.example.com ir;
 
16
    subs_filter a.example.com s.example.com;
 
17
 
 
18
}
 
19
</geshi>
 
20
 
 
21
== Directives ==
 
22
 
 
23
* [[#subs_filter_types|subs_filter_types]]
 
24
* [[#subs_filter|subs_filter]]
 
25
 
 
26
=== subs_filter_types ===
 
27
 
 
28
'''syntax:''' ''subs_filter_types mime-type [mime-types] ''
 
29
 
 
30
'''default:''' ''subs_filter_types text/html''
 
31
 
 
32
'''context:''' ''http, server, location''
 
33
 
 
34
''subs_filter_types'' is used to specify which content types should be checked for ''subs_filter''. The default is only ''text/html''.
 
35
 
 
36
=== subs_filter ===
 
37
 
 
38
'''syntax:''' ''subs_filter source_str destination_str [gior] ''
 
39
 
 
40
'''default:''' ''none''
 
41
 
 
42
'''context:''' ''http, server, location''
 
43
 
 
44
''subs_filter'' allows replacing source string(regular expression or fixed) in the nginx response with destination string. Substitution text may contain variables. More than one substitution rules per location is supported. The meaning of the third flags are:
 
45
* ''g''(default): Replace all the match strings.
 
46
* ''i'': Perform a case-insensitive match.
 
47
* ''o'': Just replace the first one.
 
48
* ''r'': The pattern is treated as a regular expression, default is fixed string.
 
49
 
 
50
=== Installation ===
 
51
 
 
52
To install, get the source with subversion:
 
53
 
 
54
<code>
 
55
svn checkout http://substitutions4nginx.googlecode.com/svn/trunk/ substitutions4nginx-read-only
 
56
</code>
 
57
 
 
58
and then compile nginx with the following option:
 
59
 
 
60
<code>
 
61
./configure --add-module=/path/to/module
 
62
</code>
 
63
 
 
64
== CHANGES ==
 
65
 
 
66
Changes with nginx_substitutions_filter 0.5.2                                     2010-08-11
 
67
 
 
68
* do many optimizing for this module
 
69
* fix a bug of buffer overlap
 
70
* fix a segment fault bug when output chain return NGX_AGAIN.
 
71
* fix a bug about last buffer with no linefeed. This may cause segment fault. Thanks for Josef Fröhle 
 
72
 
 
73
Changes with nginx_substitutions_filter 0.5                                       2010-04-15
 
74
 
 
75
* refactor the source structure, create branches of dev
 
76
* fix a bug of small chunk of buffers causing lose content
 
77
* fix the bug of last_buf and the nginx's compatibility above 0.8.25
 
78
* fix a bug with unwanted capture config error in fix string substitution
 
79
* add feature of regex captures
 
80
 
 
81
Changes with nginx_substitutions_filter 0.4                                       2009-12-23
 
82
 
 
83
* fix many bugs
 
84
 
 
85
Changes with nginx_substitutions_filter 0.3                                       2009-02-04
 
86
 
 
87
* Initial public release
 
88
 
 
89
== Reporting a bug ==
 
90
 
 
91
Questions/patches may be directed to Weibin Yao, yaoweibin@gmail.com.
 
92