mhamann closed pull request #270: Fix multiple query parameter issue for 
dynamic backends
URL: https://github.com/apache/incubator-openwhisk-apigateway/pull/270
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/scripts/lua/policies/backendRouting.lua 
b/scripts/lua/policies/backendRouting.lua
index b89f7d9..17cdc34 100644
--- a/scripts/lua/policies/backendRouting.lua
+++ b/scripts/lua/policies/backendRouting.lua
@@ -57,11 +57,13 @@ function _M.setDynamicRoute(obj)
     end
     if utils.tableContains(whitelist, u.host) then
       ngx.req.set_uri(getUriPath(u.path))
-      local query = ngx.req.get_uri_args()
-      for k, v in pairs(u.query) do
-        query[k] = v
+      -- Split the dynamicBackend url to get the query parameters in the exact 
order that it was passed in.
+      -- Don't use u.query here because it returns the parameters in an 
unordered lua table.
+      local split = {string.match(dynamicBackend, '([^?]*)?(.*)')}
+      local qs = split[2]
+      if qs ~= nil then
+        ngx.req.set_uri_args(qs)
       end
-      ngx.req.set_uri_args(query)
       setUpstream(u)
     else
       request.err(403, 'Dynamic backend host not part of whitelist.')


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to