Hello!
2014-05-24 2:51 GMT-07:00 <liuxin...@163.com>:
> 考虑到http低版本协议,可能就没有回应http 400对应的头部了。
>
较新版本的 nginx (nginx 1.5.5 以后)在此种情况下会作 HTTP 1.0 处理。你使用的 nginx
版本应该比较老。可以尝试较新版本的 nginx.
> 不知道有没有方式从lua中控制nginx在遇到403等请求时取消keepalive?
>
HTTP keepalive 和 HTTP pipelining 在 nginx 里是两回事,没有前者后者也能工作。你这里想要禁掉的其实是
HTTP pipelining,虽然迎合本身有 bug 的 http client 不是值得推荐的做法,但你仍然可以在 Lua
里面达到你要的效果:
ngx.status = 403
ngx.print("your error page content goes here...")
ngx.eof()
ngx.flush(true) -- wait for pending output data to get flushed
ngx.exit(444) -- close the connection
Regards,
-agentzh