{
  "id": "nginx/upstream-sent-invalid-server-name",
  "signature": "upstream sent invalid server name while reading response header from upstream",
  "signature_zh": "上游服务器在读取响应头时发送了无效的服务器名称",
  "regex": "upstream sent invalid server name while reading response header from upstream",
  "domain": "nginx",
  "category": "protocol_error",
  "subcategory": null,
  "root_cause": "The upstream server responded with an HTTP header containing a malformed or excessively long server name that violates HTTP specifications.",
  "root_cause_type": "generic",
  "root_cause_zh": "上游服务器响应的 HTTP 头部包含格式错误或过长的服务器名称，违反了 HTTP 规范。",
  "versions": [
    {
      "version": "nginx 1.24.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "nginx 1.22.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "nginx 1.20.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "nginx 1.18.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The error is about header value validity, not buffer capacity.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The root cause is the upstream server generating invalid headers; changing the target doesn't help.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "proxy_buffering controls response body buffering, not header validation.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Add 'proxy_ignore_headers Server;' in the location block to make nginx ignore the Server header from upstream, preventing the error.",
      "success_rate": 0.85,
      "how": "Add 'proxy_ignore_headers Server;' in the location block to make nginx ignore the Server header from upstream, preventing the error.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Fix the upstream application to send a valid Server header (e.g., 'Server: Apache/2.4.41 (Unix)') without control characters or excessive length (> 255 characters).",
      "success_rate": 0.9,
      "how": "Fix the upstream application to send a valid Server header (e.g., 'Server: Apache/2.4.41 (Unix)') without control characters or excessive length (> 255 characters).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a custom header filter with lua (if OpenResty) to sanitize the Server header: 'header_filter_by_lua_block { ngx.header[\"Server\"] = nil }'",
      "success_rate": 0.75,
      "how": "Use a custom header filter with lua (if OpenResty) to sanitize the Server header: 'header_filter_by_lua_block { ngx.header[\"Server\"] = nil }'",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Add 'proxy_ignore_headers Server;' in the location block to make nginx ignore the Server header from upstream, preventing the error.",
    "Fix the upstream application to send a valid Server header (e.g., 'Server: Apache/2.4.41 (Unix)') without control characters or excessive length (> 255 characters).",
    "Use a custom header filter with lua (if OpenResty) to sanitize the Server header: 'header_filter_by_lua_block { ngx.header[\"Server\"] = nil }'"
  ],
  "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "partial",
  "first_seen": "2023-11-22",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}