tzssangglass commented on code in PR #7065:
URL: https://github.com/apache/apisix/pull/7065#discussion_r874920709
##########
apisix/plugins/redirect.lua:
##########
@@ -148,7 +150,32 @@ function _M.rewrite(conf, ctx)
core.log.info("plugin rewrite phase, conf: ", core.json.delay_encode(conf))
local ret_code = conf.ret_code
- local ret_port = tonumber(ctx.var["var_x_forwarded_port"])
+ local ret_port = nil
+ local attr = plugin.plugin_attr("redirect")
Review Comment:
```suggestion
local attr = plugin.plugin_attr(plugin_name)
```
##########
apisix/plugins/redirect.lua:
##########
@@ -148,7 +150,32 @@ function _M.rewrite(conf, ctx)
core.log.info("plugin rewrite phase, conf: ", core.json.delay_encode(conf))
local ret_code = conf.ret_code
- local ret_port = tonumber(ctx.var["var_x_forwarded_port"])
+ local ret_port = nil
+ local attr = plugin.plugin_attr("redirect")
+ if attr then
+ ret_port = attr.https_port
+ end
+
+ if not ret_port then
+ local local_conf = core.config.local_conf()
+ local ssl = core.table.try_read_attr(local_conf,
+ "apisix",
+ "ssl")
Review Comment:
```suggestion
local ssl = core.table.try_read_attr(local_conf, "apisix", "ssl")
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]