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 ...
随机推荐
- 【SVN】如果windows用户忘记了svn的用户名和密码怎么办?
如果windows用户忘记了svn的用户名和密码怎么办? 1>你得进入默认地址 C:\Users\Administrator\AppData\Roaming\Subversion\auth\sv ...
- CCConfiguration::sharedConfiguration()->loadConfigFile cocos2d-x 中文乱码问题及国际化解决方案
from:://http://www.cnblogs.com/sunguangran/archive/2013/07/29/3222660.html 将显示文本单独保存为文本文件 在cocos2d-x ...
- 自定义兼容多种Protobuf协议的编解码器
<从零开始搭建游戏服务器>自定义兼容多种Protobuf协议的编解码器 直接在protobuf序列化数据的前面,加上一个自定义的协议头,协议头里包含序列数据的长度和对应的数据类型,在数据解 ...
- Java 集合系列之 Vector详细介绍(源码解析)和使用示例
Vector简介 Vector 是矢量队列,它是JDK1.0版本添加的类.继承于AbstractList,实现了List, RandomAccess, Cloneable这些接口. Vector 继承 ...
- Android 代码实现应用强制装到手机内存
在Froyo(android 2.2,API Level:8)中引入了android:installLocation.通过设置该属性可以使得开发者以及用户决定程序的安装位置. android:inst ...
- 从阿里Java开发手册学习线程池的正确创建方法
前言 最近看阿里的 Java开发手册,上面有线程池的一个建议: [强制]线程池不允许使用 Executors 去创建,而是通过 ThreadPoolExecutor 的方式,这样的处理方式让写的同学更 ...
- jpa命名规则 jpa使用sql语句 @Query
关键字方法命名sql where字句 AndfindByNameAndPwdwhere name= ? and pwd =? OrfindByNameOrSexwhere name= ? or sex ...
- asp.net mvc Controller控制器返回类型
ASP.NET MVC包括了执行常见任务的ActionResult类型.这些类型罗列在表5-1中.每个类型都将在随后的小节中详细讨论. 表5-1 动作结果的类型及其说明 动作结果的类型 说 明 ...
- 【VC++积累】之八、PreTranslageMessage;TranslageMessage;GetMessage和PeekMessage的区别
先来看windows消息机制: 首先系统(也就是windows)把来自硬件(鼠标,键盘等消息)和来自应用程序的消息 放到一个系统消息队列中去. 而应用程序需要有自己的消息队列,也就是线程消息队列,每一 ...
- 一次问题追查----短字符串签名算法引发的bug
近期开发代码, 出现了一些诡异现象.追查原因是公司使用的签名函数出现的问题. 问题: 代码使用的签名库函数, 对于<=4字节的字符串, 签名就是本身. #include<stdio.h&g ...