openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mham...@apache.org
Subject [incubator-openwhisk-apigateway] branch master updated: Fix multiple query parameter issue for dynamic backends (#270)
Date Wed, 03 Jan 2018 02:26:02 GMT
This is an automated email from the ASF dual-hosted git repository.

mhamann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-apigateway.git


The following commit(s) were added to refs/heads/master by this push:
     new c0294da  Fix multiple query parameter issue for dynamic backends (#270)
c0294da is described below

commit c0294da8f398f606db2d03bd72e3bc619a86bd2c
Author: Alex Song <alexsong93@gmail.com>
AuthorDate: Tue Jan 2 21:26:00 2018 -0500

    Fix multiple query parameter issue for dynamic backends (#270)
---
 scripts/lua/policies/backendRouting.lua | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

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.')

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <commits@openwhisk.apache.org>'].

Mime
View raw message