aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhouruiyu <zhouruiyu@huawei.com>2016-10-14 09:41:38 +0800
committerzhouruiyu <zhouruiyu@huawei.com>2016-10-14 09:41:38 +0800
commit45a8046221d9880ed6dd51d84c1f454af44ea0a1 (patch)
tree97a9aca7389f049b17024188202bb18f268455b7
parent8a9f53b7699b7af4df0e89dc6ce5cfcab327cec5 (diff)
Change the driver lua mis the X-Driver-Parameter and the query parameter issue.
https://jira.open-o.org/browse/OCS-108 Change-Id: I81aa9cd2f1f93b7fbb2d24c9a6ae44890973ea82 Signed-off-by: zhouruiyu <zhouruiyu@huawei.com>
-rw-r--r--msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/plugins/driver_manager.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/plugins/driver_manager.lua b/msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/plugins/driver_manager.lua
index 1dc1af7..fac8a64 100644
--- a/msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/plugins/driver_manager.lua
+++ b/msb-core/openresty-ext/src/assembly/resources/openresty/nginx/luaext/plugins/driver_manager.lua
@@ -41,8 +41,10 @@ end
local function get_driver_url(driver_header)
local cjson = require "cjson"
local query_url = get_query_url(driver_header)
+ local driver_header_value = get_driver_header();
ngx.req.clear_header(_HEADER)
local res = ngx.location.capture(query_url, { method = ngx.HTTP_GET})
+ ngx.req.set_header(_HEADER, driver_header_value);
ngx.log (ngx.ERR, "Driver manager resp url : ", tostring(res.body))
if (res.status == 200 and res.body ~= nil and res.body ~= '')
then
@@ -52,6 +54,14 @@ local function get_driver_url(driver_header)
end
end
+-- get the ori query param string
+local function get_ori_query()
+ local args = ngx.req.get_uri_args();
+ local ori_query_param = "?"..ngx.encode_args(args);
+ ngx.log(ngx.ERR, "The original request query parameter is ", ori_query_param);
+ return ori_query_param;
+end
+
-- get headers
local function get_headers()
local headers = {}
@@ -86,7 +96,7 @@ function _M.access()
if (driver_header ~= "")
then
- local driver_url = get_driver_url(driver_header)
+ local driver_url = get_driver_url(driver_header)..get_ori_query();
ngx.log (ngx.ERR, "Driver manager URl:: ", driver_url)
local http = require "resty.http"