lua-resty-limit-traffic icon indicating copy to clipboard operation
lua-resty-limit-traffic copied to clipboard

ngx.ctx with ssl_certificate_by_lua

Open phillipp opened this issue 3 years ago • 2 comments

Hi, thanks for the great work! One example of the use of ssl_certificate_by_lua_{file,block} is request limiting with this library.

But in the ssl_certificate_by_lua_* code there is no ngx.ctx available, which is used in the examples.

That would be the recommended way to store the limiter, key and delay in the ssl routine?

phillipp avatar Jul 21 '20 14:07 phillipp

@phillipp A SSL handshake (happened with connection level) may be related with multiple HTTP requests. Therefore you can't simply leave the limit in log_by_lua even ngx.ctx is available.

spacewander avatar Jul 22 '20 03:07 spacewander

It is possible to limit the request number in ssl_certificate_by_lua, but it is not possible to limit the connection number as there is no way to decrease the counter when the connection is gone.

spacewander avatar Jan 28 '21 01:01 spacewander