Troubleshooting of HTTP errors in Mandarin
Jump to navigation
Jump to search
![]() |
HTTP status code
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]
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-Type 或 Content-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
- From HTTP Cats
Related websites
其他可能原因[edit]
- CDN (Content delivery network)
Related pages[edit]
References[edit]
Troubleshooting of ...
- PHP, cUrl, Python, selenium, HTTP status code errors
- Database: SQL syntax debug, MySQL errors, MySQLTuner errors or PostgreSQL errors
- HTML/Javascript: Troubleshooting of javascript, XPath
- Software: Mediawiki, Docker, FTP problems, online conference software
- Test connectivity for the web service, Web Ping, Network problem, Web user behavior, Web scrape troubleshooting
Template