--with-http_addition_module 需要编译进Nginx
其功能主要在响应前或响应后追加内容
add_before_body 指令 将处理给定子请求后返回的文本添加到响应正文之前
Syntax: | add_before_body |
---|---|
Default: | — |
Context: |
http , server , location
|
add_after_body 指令
Syntax:add_after_body
uri
;
Default:—
Context:http
, server
, location
addition_types 指令 指定处理的文本类型
Syntax: | addition_types |
---|---|
Default: |
addition_types text/html; |
Context: |
http , server , location
|
演示
location / {
add_before_body /before_action;
add_after_body /after_action;
addition_types *; }
location /before_action {
return "before \n ";
}
location /after_action {
return "after \n";
}