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
本文介绍了如何利用openresty的header_filter_by_lua模块来新增和覆盖HTTP头。通过示例配置文件,展示了在nginx.conf中设置的方法,并提到了执行命令及运行效果。
最低0.47元/天 解锁文章
9526

被折叠的 条评论
为什么被折叠?



