From 23d3c1049138a854faeddf492b13d320d6aab192 Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Fri, 15 Mar 2024 13:45:19 -0400 Subject: [PATCH] chore: check req_uri with no query params for passthrough --- src/proxy_auth_v2.lua | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/proxy_auth_v2.lua b/src/proxy_auth_v2.lua index 147b97c..f34641f 100644 --- a/src/proxy_auth_v2.lua +++ b/src/proxy_auth_v2.lua @@ -41,7 +41,13 @@ end local req = ngx.req local req_method = req.get_method() -local req_uri = ngx.var.request_uri -- pre-rewrite URI + +local req_uri_no_qp = ngx.var.request_uri -- pre-rewrite URI +local qp = req_uri_no_qp:find("?") +if qp ~= nil then + req_uri_no_qp = req_uri_no_qp:sub(1, qp - 1) +end + local uri = ngx.var.uri -- post-rewrite URI -- BEGIN OPEN ENDPOINT LOGIC ------------------------------------------------------------ @@ -51,11 +57,11 @@ local uri = ngx.var.uri -- post-rewrite URI if req_method == "GET" and ( uri == "/service-info" or - req_uri == "/api/metadata/api/projects" or - req_uri == "/api/metadata/api/public" or - req_uri == "/api/metadata/api/public_overview" or - req_uri == "/api/metadata/api/public_search_fields" or - req_uri == "/api/metadata/api/public_dataset" + req_uri_no_qp == "/api/metadata/api/projects" or + req_uri_no_qp == "/api/metadata/api/public" or + req_uri_no_qp == "/api/metadata/api/public_overview" or + req_uri_no_qp == "/api/metadata/api/public_search_fields" or + req_uri_no_qp == "/api/metadata/api/public_dataset" ) then goto script_end end