Add proxy-rewrite plugin to remove /api prefix
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:
@@ -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 }}
|
||||||
|
|||||||
Reference in New Issue
Block a user