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. Java 导出 CSV

    package com.cib.cap4j.cfn.util; import java.io.BufferedWriter; import java.io.File; import java.io.F ...

  2. JForum 源码分析

    怎么才算好的源码分析呢?当然我这个肯定不算.我想大概分为几个层面吧,写写注释那算最基本的了,写写要点思路和难点,算是还不错拉,再难的就是跳出源码举一反三,形成自己的一套思路吧.好好努力吧. 这次针对的 ...

  3. mysql慢查询监控及sql优化

    在my.ini添加如下代码,即可查看那个sql语句执行慢了 log-slow-queries = d:/log/mysql-slow.log long_query_time = 1 打开日志 log ...

  4. cocos2d-x中使用CCOrbitCamera做水平翻转

    项目中需要用到水平翻转效果,这里偷懒了-   首先翻转,它只是转到了180度,多了就觉得很奇怪了. 所以这里设定就是先从0 ~ 90度,然后再从270 ~ 360,90 – 270 视觉上是感觉不到变 ...

  5. easyUi 的DataGrid的绑定

    html代码: @{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Index_Layout.cshtml&quo ...

  6. 转帖:向开源项目贡献源码(以 Orchard 为例)

    原文地址:http://yangw80.blog.163.com/blog/static/247518002201552692516908/ 在开源项目满天飞的时代,仅仅把开源项目拿来用是不够的,要适 ...

  7. eclipse 创建聚合maven项目

    本人不想花太多时间去排版,所以这里排版假设不好看,请多多包涵! 一直都在用maven,可是却基本没有自己创建过maven项目,今天也试着创建一个. 1.打开eclipse.然后new,other,然后 ...

  8. Java NIO AsynchronousFileChannel

    In Java 7 the AsynchronousFileChannel was added to Java NIO. The AsynchronousFileChannel makes it po ...

  9. [leetcode]Palindrome Partitioning @ Python

    原题地址:https://oj.leetcode.com/problems/palindrome-partitioning/ 题意: Given a string s, partition s suc ...

  10. 2018.08.28 ali 梯度下降法实现最小二乘

    - 要理解梯度下降和牛顿迭代法的区别 #include<stdio.h> // 1. 线性多维函数原型是 y = f(x1,x2,x3) = a * x1 + b * x2 + c * x ...