{
  "id": "nginx/upstream-sent-invalid-status-line-empty",
  "signature": "upstream sent invalid status line while reading response header from upstream, client: 10.0.0.1, server: example.com",
  "signature_zh": "上游发送了无效的状态行，从上游读取响应头时，客户端：10.0.0.1，服务器：example.com",
  "regex": "upstream sent invalid status line while reading response header from upstream",
  "domain": "nginx",
  "category": "protocol_error",
  "subcategory": null,
  "root_cause": "Upstream server sends a malformed HTTP status line (e.g., empty or missing HTTP version), causing nginx to fail parsing the response.",
  "root_cause_type": "generic",
  "root_cause_zh": "上游服务器发送了格式错误的 HTTP 状态行（例如，空行或缺少 HTTP 版本），导致 nginx 无法解析响应。",
  "versions": [
    {
      "version": "nginx 1.18.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "nginx 1.20.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "nginx 1.22.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "nginx 1.24.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Set proxy_http_version 1.1;",
      "why_fails": "The error is about a malformed status line, not the HTTP version. Changing proxy version does not fix upstream's invalid output.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase proxy_read_timeout",
      "why_fails": "Timeout does not affect the format of the response; the upstream is responding, but with invalid data.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Add proxy_buffering off;",
      "why_fails": "Buffering affects how nginx reads the response body, not the status line parsing in the header.",
      "fail_rate": 0.92,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Fix the upstream application to return a valid HTTP status line. For example, in a Python WSGI app, ensure the application returns a proper start line:\ndef application(environ, start_response):\n    status = '200 OK'\n    headers = [('Content-Type', 'text/plain')]\n    start_response(status, headers)\n    return [b'Hello World']\nCheck for missing or empty status strings in custom servers.",
      "success_rate": 0.85,
      "how": "Fix the upstream application to return a valid HTTP status line. For example, in a Python WSGI app, ensure the application returns a proper start line:\ndef application(environ, start_response):\n    status = '200 OK'\n    headers = [('Content-Type', 'text/plain')]\n    start_response(status, headers)\n    return [b'Hello World']\nCheck for missing or empty status strings in custom servers.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use nginx's proxy_pass with a rewrite to a different upstream that sanitizes responses, or place a reverse proxy like Varnish in front of the misbehaving upstream to normalize responses.",
      "success_rate": 0.7,
      "how": "Use nginx's proxy_pass with a rewrite to a different upstream that sanitizes responses, or place a reverse proxy like Varnish in front of the misbehaving upstream to normalize responses.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Fix the upstream application to return a valid HTTP status line. For example, in a Python WSGI app, ensure the application returns a proper start line:\ndef application(environ, start_response):\n    status = '200 OK'\n    headers = [('Content-Type', 'text/plain')]\n    start_response(status, headers)\n    return [b'Hello World']\nCheck for missing or empty status strings in custom servers.",
    "Use nginx's proxy_pass with a rewrite to a different upstream that sanitizes responses, or place a reverse proxy like Varnish in front of the misbehaving upstream to normalize responses."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.76,
  "resolvable": "true",
  "first_seen": "2023-11-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}