{
  "id": "grpc/grpc-web-cors-failure",
  "signature": "INTERNAL: grpc-web: CORS preflight failed for origin http://localhost:3000",
  "signature_zh": "内部错误：gRPC-Web：来源 http://localhost:3000 的 CORS 预检失败",
  "regex": "INTERNAL: grpc-web: CORS preflight failed for origin .+",
  "domain": "grpc",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The gRPC-Web proxy or server did not respond with the correct CORS headers for the preflight OPTIONS request.",
  "root_cause_type": "generic",
  "root_cause_zh": "gRPC-Web 代理或服务器未对预检 OPTIONS 请求返回正确的 CORS 头。",
  "versions": [
    {
      "version": "Envoy 1.26.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gRPC-Web 1.48.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Browsers enforce CORS; it cannot be disabled client-side.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The preflight request (OPTIONS) must be handled explicitly, not just the POST.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This only works for non-browser environments; the error is specific to browser-based gRPC-Web.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Configure the gRPC-Web proxy (e.g., Envoy) to add CORS headers. Example Envoy config snippet: `cors: { allow_origin_string_match: [{ prefix: \"http://localhost:3000\" }], allow_methods: \"POST, OPTIONS\", allow_headers: \"content-type,x-grpc-web\", max_age: \"86400\" }`",
      "success_rate": 0.9,
      "how": "Configure the gRPC-Web proxy (e.g., Envoy) to add CORS headers. Example Envoy config snippet: `cors: { allow_origin_string_match: [{ prefix: \"http://localhost:3000\" }], allow_methods: \"POST, OPTIONS\", allow_headers: \"content-type,x-grpc-web\", max_age: \"86400\" }`",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using a custom server, handle OPTIONS requests manually by returning 200 with appropriate CORS headers.",
      "success_rate": 0.85,
      "how": "If using a custom server, handle OPTIONS requests manually by returning 200 with appropriate CORS headers.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Configure the gRPC-Web proxy (e.g., Envoy) to add CORS headers. Example Envoy config snippet: `cors: { allow_origin_string_match: [{ prefix: \"http://localhost:3000\" }], allow_methods: \"POST, OPTIONS\", allow_headers: \"content-type,x-grpc-web\", max_age: \"86400\" }`",
    "If using a custom server, handle OPTIONS requests manually by returning 200 with appropriate CORS headers."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://github.com/grpc/grpc-web/blob/master/doc/cors.md",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-03-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}