Skip to content

Commit 0cd1f16

Browse files
authored
Scanning port 10247 lead to tcp connection 502 error (#9815)
* fix tcp 502 error * fix tcp 502 error for parse tcp backend data * fix tcp 502 error for parse tcp backend data
1 parent 5b35651 commit 0cd1f16

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

rootfs/etc/nginx/lua/tcp_udp_configuration.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
local ngx = ngx
22
local tostring = tostring
3+
local cjson = require("cjson.safe")
34
-- this is the Lua representation of TCP/UDP Configuration
45
local tcp_udp_configuration_data = ngx.shared.tcp_udp_configuration_data
56

@@ -37,6 +38,14 @@ function _M.call()
3738
return
3839
end
3940

41+
local _, backends_err = cjson.decode(backends)
42+
43+
if backends_err then
44+
ngx.log(ngx.ERR, "could not parse backends data: ", backends_err)
45+
return
46+
end
47+
48+
4049
local success, err_conf = tcp_udp_configuration_data:set("backends", backends)
4150
if not success then
4251
ngx.log(ngx.ERR, "dynamic-configuration: error updating configuration: " .. tostring(err_conf))

0 commit comments

Comments
 (0)