You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by mh...@apache.org on 2017/06/05 21:13:03 UTC

[incubator-openwhisk-apigateway] branch master updated: Concatenate query params from dynamic backend (#225)

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 9c38d4c  Concatenate query params from dynamic backend (#225)
9c38d4c is described below

commit 9c38d4c96525975761eb8717db83db21a8df5351
Author: Alex Song <al...@gmail.com>
AuthorDate: Mon Jun 5 17:13:00 2017 -0400

    Concatenate query params from dynamic backend (#225)
---
 scripts/lua/policies/backendRouting.lua | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/lua/policies/backendRouting.lua b/scripts/lua/policies/backendRouting.lua
index 8dde4f4..24def8e 100644
--- a/scripts/lua/policies/backendRouting.lua
+++ b/scripts/lua/policies/backendRouting.lua
@@ -46,7 +46,7 @@ function _M.setDynamicRoute(obj)
     whitelist[k] = whitelist[k]:lower()
   end
   local header = obj.header ~= nil and obj.header or 'X-Cf-Forwarded-Url'
-  local dynamicBackend = ngx.req.get_headers()[header];
+  local dynamicBackend = ngx.req.get_headers()[header]
   if dynamicBackend ~= nil and dynamicBackend ~= '' then
     local u = url.parse(dynamicBackend)
     if u.scheme == nil or u.scheme == '' then
@@ -54,6 +54,11 @@ 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
+      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" <co...@openwhisk.apache.org>'].