Skip to content

fix: replace deprecated reverse proxy director#1151

Merged
Soner (shyim) merged 1 commit into
nextfrom
fix/image-proxy-rewrite-deprecation
Jul 2, 2026
Merged

fix: replace deprecated reverse proxy director#1151
Soner (shyim) merged 1 commit into
nextfrom
fix/image-proxy-rewrite-deprecation

Conversation

@shyim

Copy link
Copy Markdown
Member

Summary

  • replace deprecated ReverseProxy.Director usage in the image proxy with ReverseProxy.Rewrite
  • move image proxy reverse proxy setup into a shared helper for command and tests
  • remove the ignored staticcheck deprecation suppressions

Testing

  • go test ./cmd/project
  • golangci-lint run
  • go test ./...

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@shyim Soner (shyim) force-pushed the fix/image-proxy-rewrite-deprecation branch from 944a723 to bbfce58 Compare July 2, 2026 07:48
@shyim

Copy link
Copy Markdown
Member Author

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 go test ./cmd/project, golangci-lint run, and go test ./....

@shyim Soner (shyim) merged commit 20b9f99 into next Jul 2, 2026
2 checks passed
@shyim Soner (shyim) deleted the fix/image-proxy-rewrite-deprecation branch July 2, 2026 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants