HttpLuaModule——翻译(二)
access_by_lua
access阶段。事例:
location / {
deny 192.168.1.1;
allow 192.168.1.0/;
allow 10.1.1.0/;
deny all;
access_by_lua '
local res = ngx.location.capture("/mysql", { ... })
...
';
# proxy_pass/fastcgi_pass/...
}
也可以这样实施:
location / {
access_by_lua '
local res = ngx.location.capture("/auth")
if res.status == ngx.HTTP_OK then
return
end
if res.status == ngx.HTTP_FORBIDDEN then
ngx.exit(res.status)
end
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
';
# proxy_pass/fastcgi_pass/postgres_pass/...
}
英文说明,没翻译过来:Note that when calling ngx.exit(ngx.OK) within a access_by_lua handler, the nginx request processing control flow will still continue to the content handler. To terminate the current request from within a access_by_lua handler, calling ngx.exit with status >= 200 (ngx.HTTP_OK) and status < 300 (ngx.HTTP_SPECIAL_RESPONSE) for successful quits andngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) (or its friends) for failures.
access_by_lua_file
同上
header_filter_by_lua
未完,待续。。。
HttpLuaModule——翻译(二)的更多相关文章
- 【翻译二十三】java-并发程序之随机数和参考资料与问题(本系列完)
Concurrent Random Numbers In JDK 7, java.util.concurrent includes a convenience class, ThreadLocalRa ...
- HttpLuaModule——翻译(Nginx API for Lua) (转)
现在我已经将翻译的内容放到:http://wiki.nginx.org/HttpLuaModuleZh Nginx API for Lua Introduction 各种各样的*_by_lua和*_b ...
- 翻译二--创建一个Web测试计划
这里主要是翻译jmeter官方文档第4章:创建一个基本的测试计划来测试一个网站.你将创建5个用户来发送请求给两个页面,同时,你将告诉用户去执行两次测试.所以,请求的总和是5(users)*2(requ ...
- HttpLuaModule——翻译(Nginx API for Lua)
现在我已经将翻译的内容放到:http://wiki.nginx.org/HttpLuaModuleZh Nginx API for Lua Introduction 各种各样的*_by_lua和*_b ...
- HttpLuaModule——翻译(一)
最近经常使用春哥和小哲老师写的NGINX-LUA,非常苦于没有中文文档,特别是向我这种英文水平实在有限的同学,所以将遇到的模块记录下来,供以后参考!原文:http://wiki.nginx.org/H ...
- 【翻译二十二】java-并发之集合与原子变量
Concurrent Collections The java.util.concurrent package includes a number of additions to the Java C ...
- 【翻译二十一】java-并发之分拆和合并
Fork/Join This section was updated to reflect features and conventions of the upcoming Java SE 8 rel ...
- 【翻译二十】-java线程池
Thread Pools Most of the executor implementations in java.util.concurrent use thread pools, which co ...
- 【翻译二】java--并发之进程与线程
Processes and Threads In concurrent programming, there are two basic units of execution: processes a ...
随机推荐
- C#编程(三十四)----------数组作为参数
原文链接: http://blog.csdn.net/shanyongxu/article/details/46765267 数组作为参数 数组可以作为参数传递给方法,也可以从方法中返回.要返回一个数 ...
- WordPress主题开发:实现分页功能
注意的是这个受后台这里的文章篇数设置所影响~ 一.使用内置方法 (WordPress 4.1以前无效) the_posts_pagination 输出分页式导航,用法: <?php the_po ...
- 反击黑客之对网站攻击者的IP追踪
ip追踪是一件比较难实现的,因为我只有一个ip,而且在没有任何技术支持下对该ip追踪,同时我在公司也没有服务器权限,仅有后台,一般的ip追踪技术分类,反应式ip追踪,主动式的追踪,分享的只是一个过程, ...
- ASP.NET MVC:Cookie 的过期时间在服务器端是获取不到的
现状 一旦 Cookie 在服务器端设置后,在后续的请求中是获取不到过期时间的,因为:Cookie 是存储和过期处理都是由客户端管理的,在后续的请求中,浏览器向服务器发送 Cookie 的时候就不包含 ...
- input输入框只能输入正整数正则
input输入框加入限制只能输入正整数,输入其他字符会自动清除: <input type="text" value="1" onkeyup="i ...
- Android Activity之间切换出现短暂黑屏的处理方法
转自:http://www.cppblog.com/fwxjj/archive/2013/01/14/197259.html 在默认情况下,Android应用程序启动时,会有一个黑屏的时期,原因是,首 ...
- [Android Pro] ESP和EBP 栈顶指针和栈底指针
cp: http://blog.csdn.net/hutao1101175783/article/details/40128587 (1)ESP:栈指针寄存器(extended stack poin ...
- Java调用DLL有多种方式,常用的方式有JNative、JNA、JNI等。
JNative方式调用dll JNative是一种能够使Java语言使调用DLL的一种技术,对JNI进行了封装,可能有些读者会有这样一个问题,JNative对JNI进行了封装,并且是一种跨语言的使用D ...
- JavaScript:RegExp 对象
ylbtech-JavaScript:RegExp 对象 1.返回顶部 RegExp 对象 RegExp 对象表示正则表达式,它是对字符串执行模式匹配的强大工具. 直接量语法 /pattern/att ...
- go语言之进阶篇网络编程
一.网络编程 1.网络分层架构 2.每层协议的功能 3.网络通信条件 网卡,mac地址(不需要用户处理) arp --->通过IP找mac 逻辑地址,ip地址(需要用户指定) ---> ...