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. eclipse 安装 weblogic server

  2. 【mybatis】【mysql】mybatis查询mysql,group by分组查询报错:Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column

    mybatis查询mysql,group by分组查询报错:Expression #1 of SELECT list is not in GROUP BY clause and contains no ...

  3. .Net中集合排序

    public class StockQuantity { public StockQuantity(string status, DateTime dateTime, int quantity) { ...

  4. 用layer-list实现弧形进度条

    本文转载自:http://www.linuxidc.com/Linux/2013-04/82743.htm 之前我有写过如何用style或者是layer-list实现自定义的横向进度条(http:// ...

  5. git别名;git配置使用shell函数;git别名使用shell函数;git获取当前分支;git alias

    获取当前分支 git symbolic-ref -q --short HEAD 2. 在git别名里使用shell函数,$1获取第一个参数的值,$2……$n依次类推,根据自己习惯需要定制 3. 提交r ...

  6. dockerfile介绍

    详细说明,阅读这篇文章吧:https://yeasy.gitbooks.io/docker_practice/image/build.html 注意点: 容器是一个进程,不是一个系统 dockerfi ...

  7. Chart/Report资源目录

    ylbtech-Chart:Chart/Report资源目录 1.Chart.js返回顶部 1-0.官网 http://www.chartjs.org 1-1.实例 http://www.chartj ...

  8. 第二十七章 springboot + zipkin(brave-okhttp实现)

    本文截取自:http://blog.csdn.net/liaokailin/article/details/52077620 一.前提 1.zipkin基本知识:附8 zipkin 2.启动zipki ...

  9. linux中断

    [一].中断底半部 1. 软中断    --->>>  执行在中断上下文  --->>>  会被中断打断,不会被软中断或进程打断  --->>> ...

  10. Mysql 高可用方案

    1 mysql分布式数据库,如 mycat https://www.cnblogs.com/zzsdream/articles/6650690.html 2 读写分离,mysql主从复制+mysql ...