{
  "id": "nextjs/invalid-image-optimization-url",
  "signature": "Error: Image optimization failed for URL '...' with status 403. The remote server blocked the request.",
  "signature_zh": "错误：图像优化失败，URL '...' 返回 403 状态。远程服务器阻止了请求。",
  "regex": "Error: Image optimization failed for URL '.*' with status 403\\.",
  "domain": "nextjs",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "Next.js Image component tries to optimize remote images by fetching them, but the remote server's firewall or CORS policy blocks requests from the Next.js server, typically due to missing or incorrect User-Agent headers.",
  "root_cause_type": "generic",
  "root_cause_zh": "Next.js 图像组件尝试通过获取远程图像来优化它们，但远程服务器的防火墙或 CORS 策略阻止了来自 Next.js 服务器的请求，通常是由于缺少或不正确的 User-Agent 标头。",
  "versions": [
    {
      "version": "next@13.5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "next@14.1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "next@15.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This only configures allowed domains for the Image component, but doesn't change the request headers that the server sends when fetching the image.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This bypasses optimization entirely, which defeats the purpose and may degrade performance. It's a workaround but doesn't fix the root cause.",
      "fail_rate": 0.3,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Configure a custom loader in next.config.js that sets the proper User-Agent header when proxying requests to the remote server.",
      "success_rate": 0.85,
      "how": "Configure a custom loader in next.config.js that sets the proper User-Agent header when proxying requests to the remote server.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a reverse proxy or middleware to fetch the image with a custom User-Agent before passing it to the Image component.",
      "success_rate": 0.8,
      "how": "Use a reverse proxy or middleware to fetch the image with a custom User-Agent before passing it to the Image component.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Configure a custom loader in next.config.js that sets the proper User-Agent header when proxying requests to the remote server.",
    "Use a reverse proxy or middleware to fetch the image with a custom User-Agent before passing it to the Image component."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://nextjs.org/docs/app/api-reference/components/image#remote-patterns",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.75,
  "resolvable": "partial",
  "first_seen": "2023-11-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}