documented the rewrite_by_lua_block {} directive.
This commit is contained in:
Родитель
37167ce58a
Коммит
2ba17fd197
|
@ -1079,6 +1079,7 @@ Directives
|
|||
* [content_by_lua_block](#content_by_lua_block)
|
||||
* [content_by_lua_file](#content_by_lua_file)
|
||||
* [rewrite_by_lua](#rewrite_by_lua)
|
||||
* [rewrite_by_lua_block](#rewrite_by_lua_block)
|
||||
* [rewrite_by_lua_file](#rewrite_by_lua_file)
|
||||
* [access_by_lua](#access_by_lua)
|
||||
* [access_by_lua_file](#access_by_lua_file)
|
||||
|
@ -1649,6 +1650,9 @@ rewrite_by_lua
|
|||
|
||||
**phase:** *rewrite tail*
|
||||
|
||||
**WARNING** Since the `v0.9.17` release, use of this directive is *discouraged*;
|
||||
use the new [rewrite_by_lua_block](#rewrite_by_lua_block) directive instead.
|
||||
|
||||
Acts as a rewrite phase 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).
|
||||
|
||||
|
@ -1764,6 +1768,33 @@ The `rewrite_by_lua` code will always run at the end of the `rewrite` request-pr
|
|||
|
||||
[Back to TOC](#directives)
|
||||
|
||||
rewrite_by_lua_block
|
||||
--------------------
|
||||
|
||||
**syntax:** *rewrite_by_lua_block { lua-script }*
|
||||
|
||||
**context:** *http, server, location, location if*
|
||||
|
||||
**phase:** *rewrite tail*
|
||||
|
||||
Similar to the [rewrite_by_lua](#rewrite_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
|
||||
|
||||
rewrite_by_lua_block {
|
||||
do_something("hello, world!\nhiya\n")
|
||||
}
|
||||
```
|
||||
|
||||
This directive was first introduced in the `v0.9.17` release.
|
||||
|
||||
[Back to TOC](#directives)
|
||||
|
||||
rewrite_by_lua_file
|
||||
-------------------
|
||||
|
||||
|
|
|
@ -1353,6 +1353,9 @@ But be very careful about malicious user inputs and always carefully validate or
|
|||
|
||||
'''phase:''' ''rewrite tail''
|
||||
|
||||
'''WARNING''' Since the <code>v0.9.17</code> release, use of this directive is ''discouraged'';
|
||||
use the new [[#rewrite_by_lua_block|rewrite_by_lua_block]] directive instead.
|
||||
|
||||
Acts as a rewrite phase 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).
|
||||
|
||||
|
@ -1460,6 +1463,29 @@ Here the Lua code <code>ngx.exit(503)</code> will never run. This will be the ca
|
|||
|
||||
The <code>rewrite_by_lua</code> code will always run at the end of the <code>rewrite</code> request-processing phase unless [[#rewrite_by_lua_no_postpone|rewrite_by_lua_no_postpone]] is turned on.
|
||||
|
||||
== rewrite_by_lua_block ==
|
||||
|
||||
'''syntax:''' ''rewrite_by_lua_block { lua-script }''
|
||||
|
||||
'''context:''' ''http, server, location, location if''
|
||||
|
||||
'''phase:''' ''rewrite tail''
|
||||
|
||||
Similar to the [[#rewrite_by_lua|rewrite_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">
|
||||
rewrite_by_lua_block {
|
||||
do_something("hello, world!\nhiya\n")
|
||||
}
|
||||
</geshi>
|
||||
|
||||
This directive was first introduced in the <code>v0.9.17</code> release.
|
||||
|
||||
== rewrite_by_lua_file ==
|
||||
|
||||
'''syntax:''' ''rewrite_by_lua_file <path-to-lua-script-file>''
|
||||
|
|
Загрузка…
Ссылка в новой задаче