fix: replace deprecated reverse proxy director#1151
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 944a723eb7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| func newImageReverseProxy(upstream *url.URL) *httputil.ReverseProxy { | ||
| return &httputil.ReverseProxy{ | ||
| Rewrite: func(req *httputil.ProxyRequest) { | ||
| req.SetURL(upstream) |
There was a problem hiding this comment.
Preserve raw queries when using Rewrite
For requests whose image URL contains query parameters that Go considers unparsable, such as semicolon-separated transform options (/img.svg?w=100;h=100&fmt=webp) or a literal bad escape, ReverseProxy cleans req.Out.URL.RawQuery before invoking Rewrite; SetURL then forwards only the cleaned query. The old Director path preserved the raw query unchanged, so these requests now reach the upstream with parameters silently dropped unless req.In.URL.RawQuery is restored after rewriting.
Useful? React with 👍 / 👎.
944a723 to
bbfce58
Compare
|
Addressed the review comment by restoring the inbound raw query after SetURL, preserving upstream base queries, and added a regression test for semicolon-separated query params. Re-ran |
Summary
ReverseProxy.Directorusage in the image proxy withReverseProxy.RewriteTesting
go test ./cmd/projectgolangci-lint rungo test ./...