14,974
edits
(Created page with "{{Draft}} HTTP status code {{LanguageSwitcher | content = EN, 漢字 }} __TOC__ == 400 Bad Request == Root cause of 400 Bad Request. HTTP Error 400. The request is badly formed. * "the server cannot or will not process the request due to something that is perceived to be a client error (for example, malformed request syntax, invalid request message framing, or deceptive request rou...") |
|||
| Line 38: | Line 38: | ||
== 429 Too Many Requests == | == 429 Too Many Requests == | ||
原因: | |||
* 太頻繁地存取網站資源或網路服務 API | |||
* | |||
* 如果是存取網路服務 | 解決方案: | ||
* '''調整延遲時間''',根據您的使用模式和服務限制進行調整,例如:增加請求之間的延遲時間(例如在每個請求之間添加 1 秒的暫停)。 | |||
* 如果是存取網路服務 API,請閱讀文件以了解 API 的存取頻率限制 (Rate Limits)。確認是否可以向服務提供商申請提高額度限制。 | |||
* '''實作指數退避重試機制''':在應用程式中偵測使用限制錯誤(HTTP 429)。每次重試失敗時增加延遲時間(例如,2 秒、4 秒、8 秒)。持續重試直到請求成功或達到最大重試次數。 | |||
參考資料: | |||
* [https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 429 Too Many Requests - HTTP | MDN] | * [https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 429 Too Many Requests - HTTP | MDN] | ||