Skip to content

web-capture gateway: replace hand-rolled reverse proxy with httputil.ReverseProxy #640

Description

Follow-up from PR #631 review (finding #7).

examples/web-capture/cmd/gateway/proxy.go hand-rolls copyHeaders/streamCopy/flushWriter/hopByHop, duplicating net/http/httputil.ReverseProxy:

  • FlushInterval = -1 gives immediate flushing for streaming responses.
  • A Director/Rewrite can inject the auth header + rewrite the target URL.
  • ModifyResponse can enforce the <400 status gate.

Correctness bonus: the hand-rolled hopByHop list misses headers named in the request's Connection header (RFC 7230 §6.1), which the stdlib strips automatically.

Deferred from PR #631 because the MSE path has bespoke readiness-retry + liveness logic (proxyMSE) layered on the streaming copy; migrating needs care to preserve that behavior and a separate review. Not a behavioral bug today.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions