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——翻译(二)的更多相关文章

  1. 【翻译二十三】java-并发程序之随机数和参考资料与问题(本系列完)

    Concurrent Random Numbers In JDK 7, java.util.concurrent includes a convenience class, ThreadLocalRa ...

  2. HttpLuaModule——翻译(Nginx API for Lua) (转)

    现在我已经将翻译的内容放到:http://wiki.nginx.org/HttpLuaModuleZh Nginx API for Lua Introduction 各种各样的*_by_lua和*_b ...

  3. 翻译二--创建一个Web测试计划

    这里主要是翻译jmeter官方文档第4章:创建一个基本的测试计划来测试一个网站.你将创建5个用户来发送请求给两个页面,同时,你将告诉用户去执行两次测试.所以,请求的总和是5(users)*2(requ ...

  4. HttpLuaModule——翻译(Nginx API for Lua)

    现在我已经将翻译的内容放到:http://wiki.nginx.org/HttpLuaModuleZh Nginx API for Lua Introduction 各种各样的*_by_lua和*_b ...

  5. HttpLuaModule——翻译(一)

    最近经常使用春哥和小哲老师写的NGINX-LUA,非常苦于没有中文文档,特别是向我这种英文水平实在有限的同学,所以将遇到的模块记录下来,供以后参考!原文:http://wiki.nginx.org/H ...

  6. 【翻译二十二】java-并发之集合与原子变量

    Concurrent Collections The java.util.concurrent package includes a number of additions to the Java C ...

  7. 【翻译二十一】java-并发之分拆和合并

    Fork/Join This section was updated to reflect features and conventions of the upcoming Java SE 8 rel ...

  8. 【翻译二十】-java线程池

    Thread Pools Most of the executor implementations in java.util.concurrent use thread pools, which co ...

  9. 【翻译二】java--并发之进程与线程

    Processes and Threads In concurrent programming, there are two basic units of execution: processes a ...

随机推荐

  1. EBS 系统当前完成请求时间监测

    /* Formatted on 2018/3/14 23:32:17 (QP5 v5.256.13226.35538) */ SELECT REQUEST_ID , PROGRAM , ROUND ( ...

  2. Android实现对HOME键的捕获和屏蔽

    1.1. 在AndroidManifest.xml中加上权限,禁止HOME键. <uses-permission android:name="android.permission.DI ...

  3. 提高你的代码稳定性与可读性-lint工具

    from://http://wiki.eoe.cn/page/Improving_Your_Code_with_lint.html 负责人:lingzideshensha 分任务原文链接:http:/ ...

  4. linux下vi操作Found a swap file by the name

    当我在linux下用vi打开Test.java文件时 [root@localhost tmp]# vi Test.java 会出现如下信息: E325: ATTENTION Found a swap  ...

  5. RecyclerView常见问题解决方案,RecyclerView嵌套自动滚动,RecyclerView 高度设置wrap_content 无作用等问题

    1,ScrollView或者RecyclerView1 嵌套RecyclerView2  进入页面自动跳转到recyclerView2上面页面会自动滚动貌似是RecyclerView 自动获得了焦点两 ...

  6. docker 日志清理与设置

    清空 cat /dev/null >json.log docker-compose nginx: image: nginx:1.12.1 restart: always logging: dri ...

  7. linux批量改名

    rename 's/abc/xyz/' * 把包含abc的文件名,替换为xyz

  8. OHEM

    样本不平衡问题 如在二分类中正负样本比例存在较大差距,导致模型的预测偏向某一类别.如果正样本占据1%,而负样本占据99%,那么模型只需要对所有样本输出预测为负样本,那么模型轻松可以达到99%的正确率. ...

  9. jquery实现相同事件名称,不同命名空间的调用方法

    <html xmlns="http://www.w3.org/1999/xhtml"> <head>  <title></title> ...

  10. iOS:简易的音视屏播放框架XYQPlayer

    一.前缀 一直都想好好学学音视频这方面的知识,抽了几个周末参考一些资料,尝试着写了一个简易的音视频播放框架,支持音视频播放.视频截图.音乐缓存,其实吧,也就是尽可能的封装罢了,方便以后自己使用.目前只 ...