spacewander commented on a change in pull request #4391:
URL: https://github.com/apache/apisix/pull/4391#discussion_r647910712
##########
File path: apisix/stream/plugins/mqtt-proxy.lua
##########
@@ -159,16 +165,38 @@ function _M.preread(conf, ctx)
core.log.info("mqtt client id: ", res.client_id)
+ local host = conf.upstream.host
+ if not host then
+ host = conf.upstream.ip
+ end
+
+ if conf.host_is_domain == nil then
+ conf.host_is_domain = not ipmatcher.parse_ipv4(host)
+ and not ipmatcher.parse_ipv6(host)
+ end
+
+ if conf.host_is_domain then
+ local ip, err = core.resolver.parse_domain(host)
+ if not ip then
+ core.log.error("failed to parse host ", host, ", err: ", err)
+ return 500
Review comment:
> Note : we can't invoke ngx.exit or core.respond.exit in rewrite phase
and access phase. if need to exit, just return the status and body, the plugin
engine will make the exit happen with the returned status and body.
https://github.com/apache/apisix/blob/master/docs/en/latest/plugin-develop.md
We need to fix it like what we have done with the http plugins
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]