{
  "id": "nginx/upstream-sent-invalid-transfer-encoding-chunked-with-content-length",
  "signature": "upstream sent invalid Transfer-Encoding: chunked with Content-Length while reading response header from upstream",
  "signature_zh": "上游发送了无效的Transfer-Encoding：chunked与Content-Length并存，同时从上游读取响应头",
  "regex": "upstream sent invalid Transfer-Encoding: chunked with Content-Length while reading response header from upstream",
  "domain": "nginx",
  "category": "protocol_error",
  "subcategory": null,
  "root_cause": "Upstream server sends both Content-Length and Transfer-Encoding: chunked headers in the same response, which is invalid per HTTP/1.1.",
  "root_cause_type": "generic",
  "root_cause_zh": "",
  "versions": [
    {
      "version": "nginx 1.24.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "nginx 1.25.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "nginx 1.26.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Remove Content-Length header from nginx config using proxy_set_header",
      "why_fails": "proxy_set_header affects request headers to upstream, not response headers from upstream.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Enable chunked_transfer_encoding off; in nginx",
      "why_fails": "This directive controls nginx's own encoding, not upstream response validation.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase proxy_buffer_size",
      "why_fails": "Header size is not the issue; header validity is.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use proxy_ignore_headers to ignore one of the conflicting headers. Example to ignore Content-Length:\n  location / {\n      proxy_pass http://upstream;\n      proxy_ignore_headers Content-Length;\n  }",
      "success_rate": 0.85,
      "how": "Use proxy_ignore_headers to ignore one of the conflicting headers. Example to ignore Content-Length:\n  location / {\n      proxy_pass http://upstream;\n      proxy_ignore_headers Content-Length;\n  }",
      "condition": "",
      "sources": []
    },
    {
      "action": "Fix the upstream application to send only one of the headers. For example, in a Node.js Express app:\n  app.get('/data', (req, res) => {\n      res.removeHeader('Content-Length');\n      res.setHeader('Transfer-Encoding', 'chunked');\n      res.send('hello');\n  });",
      "success_rate": 0.95,
      "how": "Fix the upstream application to send only one of the headers. For example, in a Node.js Express app:\n  app.get('/data', (req, res) => {\n      res.removeHeader('Content-Length');\n      res.setHeader('Transfer-Encoding', 'chunked');\n      res.send('hello');\n  });",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Use proxy_ignore_headers to ignore one of the conflicting headers. Example to ignore Content-Length:\n  location / {\n      proxy_pass http://upstream;\n      proxy_ignore_headers Content-Length;\n  }",
    "Fix the upstream application to send only one of the headers. For example, in a Node.js Express app:\n  app.get('/data', (req, res) => {\n      res.removeHeader('Content-Length');\n      res.setHeader('Transfer-Encoding', 'chunked');\n      res.send('hello');\n  });"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ignore_headers",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2025-05-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}