Editing
Troubleshooting of HTTP errors in Mandarin
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Draft}} HTTP status code {{LanguageSwitcher | content = [[Troubleshooting of HTTP errors | EN]], [[Troubleshooting of HTTP errors in Mandarin | 漢字]] }} __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 routing)"<ref>[https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 400 Bad Request - HTTP | MDN]</ref> Possibile solution: * Modify the request headers == 403 Forbidden Error == [[How to fix the 403 forbidden error]] == 404 File Not Found == 解決方法:檢查存取的連結是否正確,詳見 [[404 Not Found | 找不到網頁的可能解決方法]] == 405 Method Not Allowed Error == 解決方法:檢查存取的文件或資源支援呼叫使用的 HTTP protocol <ref>[https://dotblogs.com.tw/cotton/2018/03/01/132336 使用Http Post呼叫api卻收到405 method not allowed | 攻城獅的學習筆記 - 點部落]</ref>,例如限制使用 POST ,卻使用 GET 存取。 == 414 Request-URI Too Large == 解決方法:請求協議改用 POST 而不是 GET<ref>[https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/414 414 URI Too Long - HTTP | MDN]</ref> == 415 Unsupported Media Type == 解決方法:「於請求中設置的 {{kbd | key=Content-Type}} 或 {{kbd | key=Content-Encoding}} 或對資料的直接訪問」。參考資料:[https://developer.mozilla.org/zh-TW/docs/Web/HTTP/Status/415 415 Unsupported Media Type - HTTP | MDN] 例如:RESTful API 遇到該錯誤,可能解決方式是 HTTP Headers 加入 <pre> Content-Type: application/json </pre> == 429 Too Many Requests == 原因: * 太頻繁地存取網站資源或網路服務 API 解決方案: * '''調整延遲時間''',根據您的使用模式和服務限制進行調整,例如:增加請求之間的延遲時間(例如在每個請求之間添加 1 秒的暫停)。 * 如果是存取網路服務 API,請閱讀文件以了解 API 的存取頻率限制 (Rate Limits),例如:(1)「每分鐘請求次數」(RPM, Requests Per Minute) 每分鐘你透過 API 可以發出的最大請求數量、或 (2)「日請求次數」(RPD, Requests Per Day) 每天你透過 API 可以發出的最大請求數量。確認是否可以向服務提供商申請提高額度限制。 * '''實作指數退避重試機制''':在應用程式中偵測使用限制錯誤(HTTP 429)。每次重試失敗時增加延遲時間(例如,2 秒、4 秒、8 秒)。持續重試直到請求成功或達到最大重試次數。 參考資料: * [https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 429 Too Many Requests - HTTP | MDN] == 502 Bad Gateway == 原因: * 因為是網路設備間發生錯誤,使用者並無法直接處理<ref>[https://hostingpill.com/zh-TW/502%E9%8C%AF%E8%AA%A4%E7%9A%84%E7%B6%B2%E9%97%9C/ 什麼是502 Bad Gateway錯誤以及如何解決(輕鬆修復指南)]</ref>。 解決方法: * [https://zh.wikipedia.org/zh-tw/Help:%E7%BB%95%E8%BF%87%E6%B5%8F%E8%A7%88%E5%99%A8%E7%BC%93%E5%AD%98 繞過瀏覽器快取],瀏覽器重新整理頁面 * 過一陣子再重新連線 參考資料 * [https://developer.mozilla.org/zh-TW/docs/Web/HTTP/Status/502 502 Bad Gateway - HTTP | MDN] == Error 1020: Access Denied == * [https://www.affde.com/zh-TW/error-1020-access-denied.html 了解如何解決錯誤 1020 訪問被拒絕以使您的網站重新上線 - Affde營銷] <pre> Content-Type: application/json </pre> : https://http.cat/200.jpg : From [https://http.cat/ HTTP Cats] Related websites * [https://httpstatusdogs.com/ HTTP Status Dogs] == 其他可能原因 == * CDN ([https://en.wikipedia.org/wiki/Content_delivery_network Content delivery network]) == Related pages == * [[Troubleshooting of curl errors]] * [[Test connectivity for the web service]] == References == <references /> {{Template:Troubleshooting}} [[Category: Web server]] [[Category:Programming]] [[Category:Web scraping]]
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Draft
(
edit
)
Template:Kbd
(
edit
)
Template:LanguageSwitcher
(
edit
)
Template:Troubleshooting
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
Tools
What links here
Related changes
Special pages
Page information