Skip to content

Commit 9e19f93

Browse files
committed
redirect to ?kiosk attempt 8
1 parent e5408ca commit 9e19f93

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

k8s/drexel-scraper/templates/grafana-ingress.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ metadata:
77
cert-manager.io/cluster-issuer: letsencrypt-prod
88
nginx.ingress.kubernetes.io/server-snippet: |
99
access_by_lua_block {
10-
if ngx.var.uri == "/" then
10+
local uri = ngx.var.uri
11+
-- Check if the URI is "/" or starts with "/d/"
12+
if uri == "/" or ngx.re.find(uri, "^/d/") then
1113
local orig_args = ngx.var.args or ""
12-
-- Use ngx.re.find to match using a PCRE pattern.
14+
-- Use PCRE to check if "kiosk" exists anywhere in the query string.
1315
local res, err = ngx.re.find(orig_args, "(^|&)kiosk($|&)")
1416
if not res then
1517
local new_query
@@ -18,7 +20,7 @@ metadata:
1820
else
1921
new_query = orig_args .. "&kiosk"
2022
end
21-
return ngx.redirect(ngx.var.scheme .. "://" .. ngx.var.host .. "/?" .. new_query, 302)
23+
return ngx.redirect(ngx.var.scheme .. "://" .. ngx.var.host .. uri .. "?" .. new_query, 302)
2224
end
2325
end
2426
}

0 commit comments

Comments
 (0)