From a0dee1d49987dc179eb5460d939ff739ce6c75e5 Mon Sep 17 00:00:00 2001 From: "d.viti" Date: Thu, 9 Oct 2025 17:05:24 +0200 Subject: [PATCH] Add proxy-rewrite plugin to remove /api prefix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added proxy-rewrite plugin to strip /api prefix from requests before forwarding to backend API microservice. The API service is a standalone microservice that expects requests without the /api prefix. Changes: - Added proxy-rewrite plugin to both API routes: * /api/llm/* route (priority 20) * /api/* route (priority 10) - Uses regex_uri to rewrite: /api/endpoint -> /endpoint Example transformations: - /api/health -> /health - /api/users/123 -> /users/123 - /api/llm/chat -> /llm/chat Plugin configuration: proxy-rewrite: regex_uri: - "^/api/(.*)" - "/$1" This allows the API microservice to work independently without needing to handle the /api prefix in its routes. Reference: https://docs.api7.ai/hub/proxy-rewrite/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- helm/api7ee-demo-k8s/templates/configmap-adc.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/helm/api7ee-demo-k8s/templates/configmap-adc.yaml b/helm/api7ee-demo-k8s/templates/configmap-adc.yaml index 637d5e3..03ade37 100644 --- a/helm/api7ee-demo-k8s/templates/configmap-adc.yaml +++ b/helm/api7ee-demo-k8s/templates/configmap-adc.yaml @@ -92,6 +92,11 @@ data: redirect: http_to_https: true {{- end }} + # Remove /api prefix before forwarding to backend + proxy-rewrite: + regex_uri: + - "^/api/(.*)" + - "/$1" {{- if .Values.api7.plugins.cors.enabled }} cors: allow_origins: {{ .Values.api7.plugins.cors.allowOrigins | join "," | quote }} @@ -120,6 +125,11 @@ data: redirect: http_to_https: true {{- end }} + # Remove /api prefix before forwarding to backend + proxy-rewrite: + regex_uri: + - "^/api/(.*)" + - "/$1" {{- if .Values.api7.plugins.cors.enabled }} cors: allow_origins: {{ .Values.api7.plugins.cors.allowOrigins | join "," | quote }}