EAI-7043: fix UUID-based AIM routing via Lua filter#764
Merged
johnl-amd merged 5 commits intoJun 25, 2026
Conversation
…is present When x-ai-eg-backend is set (from body or as a direct header), x-ai-eg-model is intentionally skipped. This prevents model-name fallback rules in other HTTPRoutes from matching — Envoy Gateway maintains per-HTTPRoute ordering so an older route's model-name rule fires before a newer route's UUID rule when both have equal specificity. Without x-ai-eg-model, only the UUID rule and catch-all rules remain; the UUID rule (2 conditions) beats catch-all (0 conditions) by specificity regardless of creation order.
oskarasbrink
added a commit
that referenced
this pull request
Jun 25, 2026
merge main to get #764 into RC branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
set-model-header-from-body) now skips settingx-ai-eg-modelwhen abackendUUID is present in the request body or headers, so model-name fallback rules in other HTTPRoutes cannot match. The UUID rule (Host +x-ai-eg-backend) wins by specificity over catch-all rules regardless of HTTPRoute creation order.x-ai-eg-model-logheader, always set from the body'smodelfield, so the access log retains model attribution for both UUID-routed and model-name-routed requests.x-ai-eg-model-loginstead ofx-ai-eg-model.Root cause
Envoy Gateway merges HTTPRoute rules maintaining per-route creation-timestamp ordering, not global specificity. Two rules with equal header-match counts from different HTTPRoutes — the older route always wins. When two AIMs serve the same model, the first-created route's model-name rule would always win, routing to the wrong AIM regardless of the
x-ai-eg-backendheader.Test plan
"backend": "<uuid>"in the body; verifybackendClusterin access log shows the correct AIM's HTTPRoute rulemodelfield in access log is still populated for UUID requestsbackendfield) still works for standard OpenAI clients