Troubleshooting of HTTP errors in Mandarin

From LemonWiki共筆
Jump to navigation Jump to search


icon_scale_pencil.png This article "Troubleshooting of HTTP errors in Mandarin" is still being written. If there are any incomplete parts, you are welcome to directly edit them. 這篇文章「Troubleshooting of HTTP errors in Mandarin」內容還在撰寫中,如果有不完整的部分,歡迎你直接動手修改


HTTP status code

🌐 Switch language: EN, 漢字


400 Bad Request[edit]

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 routing)"[1]

Possibile solution:

  • Modify the request headers

403 Forbidden Error[edit]

How to fix the 403 forbidden error

404 File Not Found[edit]

解決方法:檢查存取的連結是否正確,詳見 找不到網頁的可能解決方法

405 Method Not Allowed Error[edit]

解決方法:檢查存取的文件或資源支援呼叫使用的 HTTP protocol [2],例如限制使用 POST ,卻使用 GET 存取。

414 Request-URI Too Large[edit]

解決方法:請求協議改用 POST 而不是 GET[3]

415 Unsupported Media Type[edit]

解決方法:「於請求中設置的 Content-TypeContent-Encoding 或對資料的直接訪問」。參考資料:415 Unsupported Media Type - HTTP | MDN

例如:RESTful API 遇到該錯誤,可能解決方式是 HTTP Headers 加入

Content-Type: application/json

429 Too Many Requests[edit]

原因:

  • 太頻繁地存取網站資源或網路服務 API

解決方案:

  • 調整延遲時間,根據您的使用模式和服務限制進行調整,例如:增加請求之間的延遲時間(例如在每個請求之間添加 1 秒的暫停)。
  • 如果是存取網路服務 API,請閱讀文件以了解 API 的存取頻率限制 (Rate Limits),例如:(1)「每分鐘請求次數」(RPM, Requests Per Minute) 每分鐘你透過 API 可以發出的最大請求數量、或 (2)「日請求次數」(RPD, Requests Per Day) 每天你透過 API 可以發出的最大請求數量。確認是否可以向服務提供商申請提高額度限制。
  • 實作指數退避重試機制:在應用程式中偵測使用限制錯誤(HTTP 429)。每次重試失敗時增加延遲時間(例如,2 秒、4 秒、8 秒)。持續重試直到請求成功或達到最大重試次數。

參考資料:

502 Bad Gateway[edit]

原因:

  • 因為是網路設備間發生錯誤,使用者並無法直接處理[4]

解決方法:

參考資料

Error 1020: Access Denied[edit]

Content-Type: application/json
200.jpg
From HTTP Cats

Related websites

其他可能原因[edit]

Related pages[edit]

References[edit]