Troubleshooting of HTTP errors: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
mNo edit summary
 
(20 intermediate revisions by the same user not shown)
Line 2: Line 2:


HTTP status code
HTTP status code
{{LanguageSwitcher | content = [[Troubleshooting of HTTP errors | EN]], [[Troubleshooting of HTTP errors in Mandarin | 漢字]] }}


__TOC__
__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)"
Possible solution:
* Modify the request headers
== 403 Forbidden Error ==
See: [[How to fix the 403 forbidden error]]


== 404 File Not Found ==
== 404 File Not Found ==
[[404 Not Found | 找不到網頁的可能解決方法]]
Solution: Check if the accessed link is correct, see "404 Not Found | Possible solutions for pages not found"


== 405 Method Not Allowed Error ==
== 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 存取。
Solution: Check if the accessed file or resource supports the HTTP protocol being used. For example, if the resource is restricted to POST requests but you're using GET.
 
== 414 Request-URI Too Large ==
Solution: Change the request protocol to POST instead of GET


== 415 Unsupported Media Type ==
== 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]
Solution: "Set the Content-Type or Content-Encoding in the request or direct access to the data." For example: When encountering this error with RESTful API, a possible solution is to add to the HTTP Headers:
<pre>
Content-Type: application/json
</pre>


例如:RESTful API 遇到該錯誤,可能解決方式是 HTTP Headers 加入
== 429 Too Many Requests ==
Root Cause:
 
* Accessing website resources or web service API too frequently
 
Solutions:
 
* '''Adjust the delay time''' based on your usage patterns and the service's limits e.g. Increase the delay time between requests (e.g., add a 1-second pause between each request).
* If accessing a web service API, Please refer to the documentation to understand the API access rate limits, such as:  (1) "Requests Per Minute" (RPM) – the maximum number of API requests you can make per minute, or (2) "Requests Per Day" (RPD) – the maximum number of API requests you can make per day. Check if you can request a higher quota limit from the service provider
* '''Implement exponential backoff retry mechanism''': Detect rate limit errors (HTTP 429) in your application. Increase the delay time with each failed retry (e.g., 2 seconds, 4 seconds, 8 seconds). Continue retrying until the request succeeds or maximum retry count is reached.
 
== 502 Bad Gateway ==
Cause:
* Error occurs between network devices, users cannot directly handle it.
 
Solutions:
* Bypass browser cache, refresh the page
* Try reconnecting after a while
 
== Error 1020: Access Denied ==
* See link for understanding how to resolve Error 1020 Access Denied to get your website back online


<pre>
<pre>
Line 21: Line 61:
</pre>
</pre>


: https://http.cat/200.jpg
https://http.cat/200.jpg
: From [https://http.cat/ HTTP Cats]
From HTTP Cats


Related websites
Related websites:
* [https://httpstatusdogs.com/ HTTP Status Dogs]
* [https://httpstatusdogs.com/ HTTP Status Dogs]
* [https://www.affde.com/zh-TW/error-1020-access-denied.html 了解如何解決錯誤 1020 訪問被拒絕以使您的網站重新上線 - Affde營銷]


References
== Other possible root causes ==
* CDN (Content delivery network)
 
== Related pages ==
 
* [[Troubleshooting of curl errors]]
* [[Test connectivity for the web service]]
 
== References ==


<references />
<references />
Line 34: Line 81:
{{Template:Troubleshooting}}
{{Template:Troubleshooting}}


[[Category:Programming]]
[[Category: Web server]] [[Category:Programming]] [[Category:Web scraping]]

Latest revision as of 16:55, 17 June 2025


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


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)"

Possible solution:

  • Modify the request headers

403 Forbidden Error[edit]

See: How to fix the 403 forbidden error

404 File Not Found[edit]

Solution: Check if the accessed link is correct, see "404 Not Found | Possible solutions for pages not found"

405 Method Not Allowed Error[edit]

Solution: Check if the accessed file or resource supports the HTTP protocol being used. For example, if the resource is restricted to POST requests but you're using GET.

414 Request-URI Too Large[edit]

Solution: Change the request protocol to POST instead of GET

415 Unsupported Media Type[edit]

Solution: "Set the Content-Type or Content-Encoding in the request or direct access to the data." For example: When encountering this error with RESTful API, a possible solution is to add to the HTTP Headers:

Content-Type: application/json

429 Too Many Requests[edit]

Root Cause:

  • Accessing website resources or web service API too frequently

Solutions:

  • Adjust the delay time based on your usage patterns and the service's limits e.g. Increase the delay time between requests (e.g., add a 1-second pause between each request).
  • If accessing a web service API, Please refer to the documentation to understand the API access rate limits, such as: (1) "Requests Per Minute" (RPM) – the maximum number of API requests you can make per minute, or (2) "Requests Per Day" (RPD) – the maximum number of API requests you can make per day. Check if you can request a higher quota limit from the service provider
  • Implement exponential backoff retry mechanism: Detect rate limit errors (HTTP 429) in your application. Increase the delay time with each failed retry (e.g., 2 seconds, 4 seconds, 8 seconds). Continue retrying until the request succeeds or maximum retry count is reached.

502 Bad Gateway[edit]

Cause:

  • Error occurs between network devices, users cannot directly handle it.

Solutions:

  • Bypass browser cache, refresh the page
  • Try reconnecting after a while

Error 1020: Access Denied[edit]

  • See link for understanding how to resolve Error 1020 Access Denied to get your website back online
Content-Type: application/json

200.jpg From HTTP Cats

Related websites:

Other possible root causes[edit]

  • CDN (Content delivery network)

Related pages[edit]

References[edit]


Troubleshooting of ...

Template