anomalyco / anomalyco/opencode

[Bug]: proxy forwards headers named by Connection

Open
#47,770 0 comments 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Sep 7, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

ProxyUtil.headers() removes the fixed hop-by-hop header set, but it leaves extension headers named by the incoming Connection header.

For example, with Connection: x-hop, the Connection header is removed while X-Hop: must-not-forward is still sent upstream. RFC 9110 §7.6.1 requires an intermediary to remove every field named by Connection before forwarding. Both HTTP proxy call sites use this helper.

Steps to reproduce
  1. From packages/opencode, run:

    bun -e 'import { ProxyUtil } from "./src/server/proxy-util.ts";
    console.log(Object.fromEntries(ProxyUtil.headers({
      connection: "x-hop",
      "x-hop": "must-not-forward",
      "x-end": "keep"
    })))'
    
  2. Observe that the result still contains x-hop:

    { "x-end": "keep", "x-hop": "must-not-forward" }
    

Expected: connection and x-hop are absent, while x-end remains.

Operating System

All platforms

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.