From 3f81a8181b573ac9a467c59c2bb41e6d1bb69a25 Mon Sep 17 00:00:00 2001 From: tiptophelmet Date: Fri, 21 Mar 2025 20:55:02 +0200 Subject: [PATCH] :hammer: Use `tap.routing.front.basePath` to adjust nginx blocks --- helm-chart/templates/11-nginx-config-map.yaml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/helm-chart/templates/11-nginx-config-map.yaml b/helm-chart/templates/11-nginx-config-map.yaml index 22e085059..7c2edfe54 100644 --- a/helm-chart/templates/11-nginx-config-map.yaml +++ b/helm-chart/templates/11-nginx-config-map.yaml @@ -20,8 +20,8 @@ data: client_header_buffer_size 32k; large_client_header_buffers 8 64k; - location /api { - rewrite ^/api(.*)$ $1 break; + location {{ default "" (((.Values.tap).routing).front).basePath }}/api { + rewrite ^{{ default "" (((.Values.tap).routing).front).basePath }}/api(.*)$ $1 break; proxy_pass http://kubeshark-hub; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $http_host; @@ -35,8 +35,8 @@ data: proxy_pass_request_headers on; } - location /saml { - rewrite ^/saml(.*)$ /saml$1 break; + location {{ default "" (((.Values.tap).routing).front).basePath }}/saml { + rewrite ^{{ default "" (((.Values.tap).routing).front).basePath }}/saml(.*)$ /saml$1 break; proxy_pass http://kubeshark-hub; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $http_host; @@ -46,6 +46,17 @@ data: proxy_pass_request_headers on; } +{{- if (((.Values.tap).routing).front).basePath }} + location {{ .Values.tap.routing.front.basePath }} { + rewrite ^{{ .Values.tap.routing.front.basePath }}(.*)$ $1 break; + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + expires -1; + add_header Cache-Control no-cache; + } +{{- end }} + location / { root /usr/share/nginx/html; index index.html index.htm;