Firstsawyou commented on a change in pull request #4152:
URL: https://github.com/apache/apisix/pull/4152#discussion_r622890894



##########
File path: apisix/plugins/redirect.lua
##########
@@ -129,17 +159,34 @@ function _M.rewrite(conf, ctx)
         end
     end
 
-    if uri and ret_code then
-        local new_uri, err = concat_new_uri(uri, ctx)
-        if not new_uri then
-            core.log.error("failed to generate new uri by: ", uri, " error: ",
-                           err)
-            return 500
+    if ret_code then
+        if uri then
+            local new_uri, err = concat_new_uri(uri, ctx)
+            if not new_uri then
+                local msg = "failed to generate new uri by: " .. uri .. err
+                core.log.error(msg)

Review comment:
       I think it's better that way.
   ```suggestion
                   core.log.error("failed to generate new uri by: " .. uri .. 
err)
   ```




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