header_filter_by_lua的说明:
header_filter_by_lua
syntax: header_filter_by_lua <lua-script-str>
context: http, server, location, location if
phase: output-header-filter
WARNING Since the v0.9.17 release, use of this directive is discouraged; use the new header_filter_by_lua_block directive instead.
Uses Lua code specified in <lua-script-str> to define an output header filter.
Note that the following API functions are currently disabled within this context:
Output API functions (e.g., ngx.say and ngx.send_headers)
Control API functions (e.g., ngx.redirect and ngx.exec)
Subrequest API functions (e.g., ngx.location.capture and ngx.location.capture_multi)
Cosocket API functions (e.g., ngx.socket.tcp and ngx.req.socket).
Here is an example of overriding a response header (or adding one if absent) in our Lua header filter:
location / {
pro