documented the content_by_lua_block {} directive.
This commit is contained in:
Родитель
def5d55008
Коммит
37167ce58a
|
@ -1076,6 +1076,7 @@ Directives
|
||||||
* [set_by_lua_block](#set_by_lua_block)
|
* [set_by_lua_block](#set_by_lua_block)
|
||||||
* [set_by_lua_file](#set_by_lua_file)
|
* [set_by_lua_file](#set_by_lua_file)
|
||||||
* [content_by_lua](#content_by_lua)
|
* [content_by_lua](#content_by_lua)
|
||||||
|
* [content_by_lua_block](#content_by_lua_block)
|
||||||
* [content_by_lua_file](#content_by_lua_file)
|
* [content_by_lua_file](#content_by_lua_file)
|
||||||
* [rewrite_by_lua](#rewrite_by_lua)
|
* [rewrite_by_lua](#rewrite_by_lua)
|
||||||
* [rewrite_by_lua_file](#rewrite_by_lua_file)
|
* [rewrite_by_lua_file](#rewrite_by_lua_file)
|
||||||
|
@ -1566,6 +1567,9 @@ content_by_lua
|
||||||
|
|
||||||
**phase:** *content*
|
**phase:** *content*
|
||||||
|
|
||||||
|
**WARNING** Since the `v0.9.17` release, use of this directive is *discouraged*;
|
||||||
|
use the new [content_by_lua_block](#content_by_lua_block) directive instead.
|
||||||
|
|
||||||
Acts as a "content handler" and executes Lua code string specified in `<lua-script-str>` for every request.
|
Acts as a "content handler" and executes Lua code string specified in `<lua-script-str>` for every request.
|
||||||
The Lua code may make [API calls](#nginx-api-for-lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox).
|
The Lua code may make [API calls](#nginx-api-for-lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox).
|
||||||
|
|
||||||
|
@ -1573,6 +1577,33 @@ Do not use this directive and other content handler directives in the same locat
|
||||||
|
|
||||||
[Back to TOC](#directives)
|
[Back to TOC](#directives)
|
||||||
|
|
||||||
|
content_by_lua_block
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
**syntax:** *content_by_lua_block { lua-script }*
|
||||||
|
|
||||||
|
**context:** *location, location if*
|
||||||
|
|
||||||
|
**phase:** *content*
|
||||||
|
|
||||||
|
Similar to the [content_by_lua](#content_by_lua) directive except that this directive inlines
|
||||||
|
the Lua source directly
|
||||||
|
inside a pair of curly braces (`{}`) instead of in an NGINX string literal (which requires
|
||||||
|
special character escaping).
|
||||||
|
|
||||||
|
For instance,
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
|
||||||
|
content_by_lua_block {
|
||||||
|
ngx.say("I need no extra escaping here, for example: \r\nblah")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This directive was first introduced in the `v0.9.17` release.
|
||||||
|
|
||||||
|
[Back to TOC](#directives)
|
||||||
|
|
||||||
content_by_lua_file
|
content_by_lua_file
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
|
|
@ -1282,11 +1282,37 @@ This directive requires the [https://github.com/simpl/ngx_devel_kit ngx_devel_ki
|
||||||
|
|
||||||
'''phase:''' ''content''
|
'''phase:''' ''content''
|
||||||
|
|
||||||
|
'''WARNING''' Since the <code>v0.9.17</code> release, use of this directive is ''discouraged'';
|
||||||
|
use the new [[#content_by_lua_block|content_by_lua_block]] directive instead.
|
||||||
|
|
||||||
Acts as a "content handler" and executes Lua code string specified in <code><lua-script-str></code> for every request.
|
Acts as a "content handler" and executes Lua code string specified in <code><lua-script-str></code> for every request.
|
||||||
The Lua code may make [[#Nginx API for Lua|API calls]] and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox).
|
The Lua code may make [[#Nginx API for Lua|API calls]] and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox).
|
||||||
|
|
||||||
Do not use this directive and other content handler directives in the same location. For example, this directive and the [[HttpProxyModule#proxy_pass|proxy_pass]] directive should not be used in the same location.
|
Do not use this directive and other content handler directives in the same location. For example, this directive and the [[HttpProxyModule#proxy_pass|proxy_pass]] directive should not be used in the same location.
|
||||||
|
|
||||||
|
== content_by_lua_block ==
|
||||||
|
|
||||||
|
'''syntax:''' ''content_by_lua_block { lua-script }''
|
||||||
|
|
||||||
|
'''context:''' ''location, location if''
|
||||||
|
|
||||||
|
'''phase:''' ''content''
|
||||||
|
|
||||||
|
Similar to the [[#content_by_lua|content_by_lua]] directive except that this directive inlines
|
||||||
|
the Lua source directly
|
||||||
|
inside a pair of curly braces (`{}`) instead of in an NGINX string literal (which requires
|
||||||
|
special character escaping).
|
||||||
|
|
||||||
|
For instance,
|
||||||
|
|
||||||
|
<geshi lang="nginx">
|
||||||
|
content_by_lua_block {
|
||||||
|
ngx.say("I need no extra escaping here, for example: \r\nblah")
|
||||||
|
}
|
||||||
|
</geshi>
|
||||||
|
|
||||||
|
This directive was first introduced in the <code>v0.9.17</code> release.
|
||||||
|
|
||||||
== content_by_lua_file ==
|
== content_by_lua_file ==
|
||||||
|
|
||||||
'''syntax:''' ''content_by_lua_file <path-to-lua-script-file>''
|
'''syntax:''' ''content_by_lua_file <path-to-lua-script-file>''
|
||||||
|
|
Загрузка…
Ссылка в новой задаче