proxyToUpstream: add redirect with trailing slash to upstream endpoint#322
proxyToUpstream: add redirect with trailing slash to upstream endpoint#322mostlygeek merged 2 commits intomainfrom
Conversation
WalkthroughAdds a redirect in proxyToUpstream for requests where the upstream path exactly matches a model name and lacks a trailing slash: constructs /upstream/{model}/ (preserving query string) and returns a 301 for GET/HEAD or 308 for other methods. No exported API changes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant Proxy as ProxyManager
Note over Client,Proxy: Request path equals model name without trailing slash
Client->>Proxy: GET/POST /upstream/{model}?q=...
alt Path == model and no trailing slash
rect rgb(230,245,255)
Proxy-->>Client: 301 (GET/HEAD) or 308 (other) Redirect to /upstream/{model}/?q=...
end
else Other paths
Proxy->>Upstream: Forward request
Upstream-->>Proxy: Response
Proxy-->>Client: Response
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
mostlygeek#322) This adds a redirect to the upstream endpoint so it always ends with a trailing /. Fixes mostlygeek#321
Fixes #321
Summary by CodeRabbit