mirror of
https://github.com/alibaba/higress.git
synced 2026-05-30 23:57:28 +08:00
Fix the issue where AI route fallback does not work when using Bedrock. (#2653)
This commit is contained in:
@@ -97,6 +97,9 @@ func initContext(ctx wrapper.HttpContext) {
|
||||
value, _ := proxywasm.GetHttpRequestHeader(header)
|
||||
ctx.SetContext(ctxKey, value)
|
||||
}
|
||||
for _, originHeader := range headerToOriginalHeaderMapping {
|
||||
proxywasm.RemoveHttpRequestHeader(originHeader)
|
||||
}
|
||||
}
|
||||
|
||||
func saveContextsToHeaders(ctx wrapper.HttpContext) {
|
||||
@@ -127,6 +130,9 @@ func onHttpRequestHeader(ctx wrapper.HttpContext, pluginConfig config.PluginConf
|
||||
|
||||
log.Debugf("[onHttpRequestHeader] provider=%s", activeProvider.GetProviderType())
|
||||
|
||||
// Disable the route re-calculation since the plugin may modify some headers related to the chosen route.
|
||||
ctx.DisableReroute()
|
||||
|
||||
initContext(ctx)
|
||||
|
||||
rawPath := ctx.Path()
|
||||
@@ -156,8 +162,6 @@ func onHttpRequestHeader(ctx wrapper.HttpContext, pluginConfig config.PluginConf
|
||||
}
|
||||
|
||||
ctx.SetContext(provider.CtxKeyApiName, apiName)
|
||||
// Disable the route re-calculation since the plugin may modify some headers related to the chosen route.
|
||||
ctx.DisableReroute()
|
||||
|
||||
// Always remove the Accept-Encoding header to prevent the LLM from sending compressed responses,
|
||||
// allowing plugins to inspect or modify the response correctly
|
||||
|
||||
Reference in New Issue
Block a user