{
  "id": "dotnet/aspnetcore-cors-preflight-failure",
  "signature": "Access to XMLHttpRequest at 'https://api.example.com' from origin 'https://app.example.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.",
  "signature_zh": "从源 'https://app.example.com' 对 'https://api.example.com' 的 XMLHttpRequest 访问已被 CORS 策略阻止：预检请求的响应未通过访问控制检查：它没有 HTTP 正常状态。",
  "regex": "Access to XMLHttpRequest at.*has been blocked by CORS policy.*preflight request.*HTTP ok status",
  "domain": "dotnet",
  "category": "auth_error",
  "subcategory": null,
  "root_cause": "CORS preflight OPTIONS request fails because the server does not respond with a 200 status or missing required CORS headers (e.g., Access-Control-Allow-Origin).",
  "root_cause_type": "generic",
  "root_cause_zh": "CORS 预检 OPTIONS 请求失败，因为服务器未返回 200 状态或缺少必需的 CORS 头（例如 Access-Control-Allow-Origin）。",
  "versions": [
    {
      "version": "dotnet 6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "dotnet 8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "ASP.NET Core 6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "ASP.NET Core 8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Only works locally; production browsers enforce CORS, breaking the app for real users.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Preflight still fails if the server returns 404 or 500 for OPTIONS; the header alone is not enough.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "CORS with credentials requires specific headers (Access-Control-Allow-Credentials: true) and cannot use wildcard origin.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Configure ASP.NET Core CORS middleware to handle preflight requests correctly. Example in Program.cs:",
      "success_rate": 0.9,
      "how": "Configure ASP.NET Core CORS middleware to handle preflight requests correctly. Example in Program.cs:",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using custom middleware, ensure OPTIONS requests return 200 with appropriate headers before other middleware.",
      "success_rate": 0.85,
      "how": "If using custom middleware, ensure OPTIONS requests return 200 with appropriate headers before other middleware.",
      "condition": "",
      "sources": []
    },
    {
      "action": "For development, use a proxy in the client app (e.g., in React or Angular) to avoid CORS entirely.",
      "success_rate": 0.8,
      "how": "For development, use a proxy in the client app (e.g., in React or Angular) to avoid CORS entirely.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Configure ASP.NET Core CORS middleware to handle preflight requests correctly. Example in Program.cs:",
    "If using custom middleware, ensure OPTIONS requests return 200 with appropriate headers before other middleware.",
    "For development, use a proxy in the client app (e.g., in React or Angular) to avoid CORS entirely."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://learn.microsoft.com/en-us/aspnet/core/security/cors?view=aspnetcore-8.0",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.87,
  "resolvable": "true",
  "first_seen": "2023-04-18",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}