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 ...
随机推荐
- 【Android】开源项目汇总-备用
from://http://www.eoeandroid.com/home.php?mod=space&uid=765778&do=blog&id=47674 Android开 ...
- 使用VMWare虚拟机创建CentOS版本号的Linux学习环境(每一步都有截图与说明)
学习Android开发.假设不学习Linux的基本使用,总感觉心里过意不去,由于毕竟Android还是搭载在Linux的基础之上的. 因此.学习一种Linux系统的基本操作.对我们以后的学习还是非常有 ...
- WebView入门
webview是Android展示网页信息的控件,本文就来简要讲解这个控件的用法.关于webview我找到了一些很不错的文章,我就直接贴上连接,自己就不重复造轮子了.本文仅写出我本人目前使用过的东西, ...
- Android动画学习笔记大集合
其实动画这个东西我已经了解过很长一段时间了,但是一直没系统的整理过.关于android中的各种动画虽然都会用,但总怕自己会慢慢遗忘.这回看了几篇动画分析的文章,自己也学到了一些东西,在此就梳理一下. ...
- Java常用工具类之ArrayUtil
过滤 ArrayUtil.filter方法用于编辑已有数组元素,只针对泛型数组操作,原始类型数组并未提供. 方法中Editor接口用于返回每个元素编辑后的值,返回null此元素将被抛弃. 例如:过滤数 ...
- C# 获取文件的MIME类型
在C#中获取文件的MIME类型(Content Type)的方法如下 一.使用MimeMapping类 在System.Web程序集中,当前为静态类,就一个获取 // // 摘要: // 映射文档扩展 ...
- Reader 与 Guava MultiReader
Reader是Java IO体系里字符处理读取流的基本类,代码如下 /* * %W% %E% * * Copyright (c) 2006, Oracle and/or its affiliates. ...
- Verilog 加法器和减法器(6)
为了减小行波进位加法器中进位传播延迟的影响,可以尝试在每一级中快速计算进位,如果能在较短时间完成计算,则可以提高加法器性能. 我们可以进行如下的推导: 设 gi=xi&yi, pi = xi ...
- 集合 enum 枚举 简介 案例 MD
Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...
- 基于单个 div 的 CSS 绘图
为什么只使用一个 Div? 2013年5月,我参加了 CSSConf,看到了Lea Verou 关于 border-radius 的演讲,你可能会认为这个属性很不起眼.但是这个演讲让我大开眼界,认识到 ...