Skip to content

Commit

Permalink
chore: check req_uri with no query params for passthrough
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Mar 15, 2024
1 parent 38d9235 commit 23d3c10
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/proxy_auth_v2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 ------------------------------------------------------------
Expand All @@ -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
Expand Down

0 comments on commit 23d3c10

Please sign in to comment.