From 234afdd1848fcc965d1f4c5f5021099573d6a0a4 Mon Sep 17 00:00:00 2001 From: igor04091968 Date: Fri, 3 Jul 2026 10:07:41 +0300 Subject: [PATCH] Fix DetMir portal gateway API mapping --- ansible/templates/proxmox-web-gateway.conf.j2 | 11 +++++++++-- scripts/detmir-portal-tabs-smoke.mjs | 17 ++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ansible/templates/proxmox-web-gateway.conf.j2 b/ansible/templates/proxmox-web-gateway.conf.j2 index ffa0ce7..076bc7b 100644 --- a/ansible/templates/proxmox-web-gateway.conf.j2 +++ b/ansible/templates/proxmox-web-gateway.conf.j2 @@ -271,17 +271,24 @@ server { location ^~ /portal/api/dlp/evidence { proxy_set_header Authorization ""; proxy_set_header X-Remote-User $remote_user; - proxy_pass http://192.0.2.13:8721/api/dlp/evidence; + proxy_pass http://127.0.0.1:8720/api/dlp/evidence; proxy_redirect off; } - location ^~ /portal/api/readiness { + location = /portal/api/readiness { proxy_set_header Authorization ""; proxy_set_header X-Remote-User $remote_user; proxy_pass http://127.0.0.1:8720/readyz; proxy_redirect off; } + location ^~ /portal/api/readiness/ { + proxy_set_header Authorization ""; + proxy_set_header X-Remote-User $remote_user; + proxy_pass http://127.0.0.1:8720/api/readiness/; + proxy_redirect off; + } + location /portal/ { proxy_set_header Authorization ""; proxy_set_header X-Remote-User $remote_user; diff --git a/scripts/detmir-portal-tabs-smoke.mjs b/scripts/detmir-portal-tabs-smoke.mjs index 47a9d6e..2a9deb2 100644 --- a/scripts/detmir-portal-tabs-smoke.mjs +++ b/scripts/detmir-portal-tabs-smoke.mjs @@ -61,6 +61,16 @@ function expectedSecurityEventsText(mode) { return ""; } +function isExpectedProtectedResponse(response) { + if (response.status() !== 403) return false; + try { + const { pathname } = new URL(response.url()); + return pathname.endsWith("/api/security/findings"); + } catch { + return false; + } +} + function forbiddenExecutiveTerms(text) { const forbidden = [ "Trust KPI", @@ -142,9 +152,14 @@ async function main() { const badResponses = []; page.on("pageerror", (error) => errors.push(error.message)); page.on("console", (message) => { - if (message.type() === "error") errors.push(message.text()); + if (message.type() !== "error") return; + const text = message.text(); + if (text.includes("/api/security/findings") && text.includes("403")) return; + if (text === "Failed to load resource: the server responded with a status of 403 ()") return; + errors.push(text); }); page.on("response", (response) => { + if (isExpectedProtectedResponse(response)) return; if (response.status() >= 400) badResponses.push({ url: response.url(), status: response.status() }); });