gy09535 commented on a change in pull request #2311:
URL: https://github.com/apache/apisix/pull/2311#discussion_r494867847



##########
File path: apisix/plugins/redirect.lua
##########
@@ -133,7 +135,11 @@ function _M.rewrite(conf, ctx)
         -- TODO: add test case
         -- PR: https://github.com/apache/apisix/pull/1958
         uri = "https://$host$request_uri";
-        ret_code = 301
+        if ngx.req.get_method() == http_post then
+            ret_code = 308
+        else
+            ret_code = 301
+        end

Review comment:
       I think when you choice http to https, you can not use user ret_code 
,because http to https is an features, it means you set the redirect 301 but 
how handle post method , you can set 308, when the http is become https ,the 
user code is effect. what do you think @liuhengloveyou ? 

##########
File path: apisix/plugins/redirect.lua
##########
@@ -133,7 +135,11 @@ function _M.rewrite(conf, ctx)
         -- TODO: add test case
         -- PR: https://github.com/apache/apisix/pull/1958
         uri = "https://$host$request_uri";
-        ret_code = 301
+        if ngx.req.get_method() == http_post then
+            ret_code = 308
+        else
+            ret_code = 301
+        end

Review comment:
       I think when you choice http to https, you can not use user ret_code 
,because http to https is an features, it means you set the redirect 301 but 
how handle post method , you can set 308, when the http is become https ,the 
user code is effect. I think is the reason why @membphis  use 301 and not us 
user ret_code , what do you think @liuhengloveyou ? 

##########
File path: apisix/plugins/redirect.lua
##########
@@ -133,7 +135,11 @@ function _M.rewrite(conf, ctx)
         -- TODO: add test case
         -- PR: https://github.com/apache/apisix/pull/1958
         uri = "https://$host$request_uri";
-        ret_code = 301
+        if ngx.req.get_method() == http_post then
+            ret_code = 308
+        else
+            ret_code = 301
+        end

Review comment:
       I think when you choice http to https, you can not use user ret_code 
,because http to https is an features, it means you set the redirect 301 but 
how handle post method , you can set 308, when the http is become https ,the 
user code is effect. I think is the reason why @membphis  use 301 and not use 
user ret_code , what do you think @liuhengloveyou ? 

##########
File path: apisix/plugins/redirect.lua
##########
@@ -133,7 +135,11 @@ function _M.rewrite(conf, ctx)
         -- TODO: add test case
         -- PR: https://github.com/apache/apisix/pull/1958
         uri = "https://$host$request_uri";
-        ret_code = 301
+        if ngx.req.get_method() == http_post then

Review comment:
       sure




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


Reply via email to