openresty / lua-nginx-module

Embed the Power of Lua into NGINX HTTP servers
https://openresty.org/
11.33k stars 2.03k forks source link

Aborting Nginx reload on condition #2308

Closed Rockybilly closed 6 months ago

Rockybilly commented 7 months ago

Hello, is there a way with lua that, upon checking a condition, abort an nginx reload with error, so the old conf keeps running.

I have this in my _xxx_by_luablock codes in the conf: local m = require(module)

if this fails, all the requests in the server becomes HTTP 500. This fails obviously because of an error in the lua code, however to be extra careful I want to prevent reload if an error can be found before the worker starts running.

Rockybilly commented 6 months ago

See: https://github.com/openresty/lua-nginx-module/issues/2311