### Addition妯″潡
This module adds responses of other locations before and after the current location's response.
It is implemented as an output filter, the contents of the main request and subrequests to other locations are not buffered completely and are still sent to the client in a streaming fashion. Because the length of the final response body is unkown while sending the HTTP headers, the HTTP chunked encoding is always used here.
### Installation
By default the module is not built, it is necessary to enable its build with
~~~
./configure --with-http_addition_module
~~~
at compilation time.
Example:
~~~
location / {
add_before_body /before_action;
add_after_body /after_action;
}
~~~
### Limitations
Note that as of 0.8.17 no contents will be added if the current location is served as a subrequest itself. Consider the following example:
~~~
location /foo {
add_before_body /bar;
}
?
location /bar {
add_before_body /baz;
}
~~~
Then accessing */foo* won't get */baz* inserted before the contents of the subrequest */bar*.
Also note that at this time, only strings can be used in before/after body locations, not variables. So
~~~
location / {
set $before_action /before_action;
add_before_body $before_action;
}
~~~
will not work as expected (although the configuration file will still load properly).
### Directives
### add_before_body
**syntax:***add_before_body uri*
**default:***no*
**context:***http, server, location*
Directive adds content of uri before the response body, issued as a result of the work of the assigned subrequest.
### add_after_body
**syntax:***add_after_body uri*
**default:***no*
**context:***http, server, location*
Directive adds content of uri after the response body, issued as a result of the work of the assigned subrequest.
### addition_types
**syntax:***addition_types mime-type [mime-type ...]*
**default:***text/html*
**context:***http, server, location*
Directive (since 0.7.9) allows you to add text only to locations of the specified MIME-types (defaults to *"text/html"*).
(Before 0.8.17, this directive was mispelled as "addtion_types" in the source. This bug has been fixed in 0.8.17.)
### References
[Original Documentation](http://sysoev.ru/nginx/docs/http/ngx_http_addition_module.html "http://sysoev.ru/nginx/docs/http/ngx_http_addition_module.html")
- 主要文檔
- Nginx功能概述
- 為什么選擇Nginx
- Nginx安裝
- 運行和控制Nginx
- 配置符號參考
- 優化 Nginx
- 常見問題(FAQ)
- 調試 nginx
- 核心模塊
- Nginx主模塊
- Nginx事件模塊
- 基本模塊
- http核心模塊
- HttpIndex模塊
- HttpAccess模塊
- HttpAuthBasic模塊
- HttpAutoindex模塊
- Browser模塊
- Charset模塊
- HttpEmptyGif模塊
- HttpFcgi模塊
- Geo模塊
- HttpGzip模塊
- HttpHeaders模塊
- HttpIndex模塊
- HttpReferer模塊
- HttpLimit zone
- HttpLimitReqest模塊
- HttpLog模塊
- map
- Memcached
- HttpProxy模塊
- HttpRewrite模塊
- HttpSSI模塊
- HttpUserId
- 其他模塊
- Addition模塊
- EmbeddedPerl
- flv
- HttpGzipStatic
- RandomIndex
- HttpGeoIP
- HttpRealIp
- HttpSSL
- StubStatus模塊
- HttpSubstitution
- HttpDav模塊
- GooglePerftools
- HttpXSLT
- HttpSecureLink
- HttpImageFilter
- mail模塊
- MailCore
- MailAuth
- MailProxy
- MailSSL
- 安裝
- nginx在windows上的安裝
- nginx在freebsd上的安裝
- nginx在ubuntu上的安裝
- nginx在fedora上的安裝
- nginx php-fpm安裝配置
- 配置示例和方法
- 完整例子
- 完整例子2
- 虛擬主機
- 負載均衡
- nginx防盜鏈
- HWLoadbalancerCheckErrors