Add proxy-rewrite plugin to remove /api prefix
Some checks failed
Helm Chart Build / lint-only (push) Has been skipped
Build and Deploy / build-web (push) Failing after 7s
Helm Chart Build / build-helm (push) Successful in 12s
Build and Deploy / build-api (push) Successful in 42s

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 <noreply@anthropic.com>
This commit is contained in:
d.viti
2025-10-09 17:05:24 +02:00
parent b8a483db71
commit a0dee1d499

View File

@@ -92,6 +92,11 @@ data:
redirect: redirect:
http_to_https: true http_to_https: true
{{- end }} {{- end }}
# Remove /api prefix before forwarding to backend
proxy-rewrite:
regex_uri:
- "^/api/(.*)"
- "/$1"
{{- if .Values.api7.plugins.cors.enabled }} {{- if .Values.api7.plugins.cors.enabled }}
cors: cors:
allow_origins: {{ .Values.api7.plugins.cors.allowOrigins | join "," | quote }} allow_origins: {{ .Values.api7.plugins.cors.allowOrigins | join "," | quote }}
@@ -120,6 +125,11 @@ data:
redirect: redirect:
http_to_https: true http_to_https: true
{{- end }} {{- end }}
# Remove /api prefix before forwarding to backend
proxy-rewrite:
regex_uri:
- "^/api/(.*)"
- "/$1"
{{- if .Values.api7.plugins.cors.enabled }} {{- if .Values.api7.plugins.cors.enabled }}
cors: cors:
allow_origins: {{ .Values.api7.plugins.cors.allowOrigins | join "," | quote }} allow_origins: {{ .Values.api7.plugins.cors.allowOrigins | join "," | quote }}