tzssangglass commented on a change in pull request #6242:
URL: https://github.com/apache/apisix/pull/6242#discussion_r802196294



##########
File path: apisix/plugins/redirect.lua
##########
@@ -150,7 +150,9 @@ function _M.rewrite(conf, ctx)
     local uri = conf.uri
     local regex_uri = conf.regex_uri
 
-    if conf.http_to_https and ctx.var.scheme == "http" then
+    local proxy_proto = core.request.header(ctx, "x-forwarded-proto")
+    local _scheme = proxy_proto or ctx.var.scheme

Review comment:
       ```suggestion
       local proxy_proto = core.request.header(ctx, "X-Forwarded-Proto")
       local _scheme = proxy_proto or core.request.get_scheme(ctx)
   ```

##########
File path: t/plugin/redirect.t
##########
@@ -1000,3 +1000,44 @@ Location: /hello?type=string&name=json
 --- error_code: 302
 --- no_error_log
 [error]
+
+
+
+=== TEST 41: redirect
+--- config
+    location /t {
+        content_by_lua_block {
+            local t = require("plugin.redirect").test

Review comment:
       ```suggestion
               local t = require("lib.test_admin").test
   ```




-- 
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]


Reply via email to