15,047
edits
No edit summary |
|||
| (10 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 == | == Troubleshooting HTTP Status Errors == | ||
=== 400 Bad Request === | |||
Root cause: The request itself is malformed. According to the spec, this means "the server cannot or will not process the request due to something perceived to be a client error" — such as invalid syntax, incorrect request message framing, or deceptive request routing. | |||
Possible fix: | |||
* Review and correct the request headers | |||
=== 403 Forbidden === | |||
See: [[How to fix the 403 forbidden error]] | |||
== | === 404 Not Found === | ||
[[ | Fix: Verify that the URL is correct. For more details, see | ||
[[404 Not Found]], possible solutions for pages not found". | |||
== | === 405 Method Not Allowed === | ||
Fix: Confirm that the target resource supports the HTTP method you're using. For example, the endpoint may only accept POST requests while you're sending a GET request. | |||
== 414 Request-URI Too Large == | === 414 Request-URI Too Large === | ||
Fix: Switch from GET to POST so the data is sent in the request body instead of the URL. | |||
=== 415 Unsupported Media Type === | |||
Fix: Explicitly declare the correct Content-Type or Content-Encoding in the request, or access the data directly. For instance, when calling a RESTful API, this error can often be resolved by adding the following header: | |||
<pre> | <pre> | ||
Content-Type: application/json | Content-Type: application/json | ||
</pre> | </pre> | ||
== 429 Too Many Requests == | === 429 Too Many Requests === | ||
Root cause: | |||
* | * The client is hitting the website or API more frequently than the service allows. | ||
Fixes: | |||
* | * '''Throttle your requests''': Add or increase a delay between requests based on your usage pattern and the service's limits (e.g., pause 1 second between calls). | ||
* '''Check the API rate limits''': Consult the provider's documentation for limits such as Requests Per Minute (RPM) or Requests Per Day (RPD), and find out whether you can request a higher quota. | |||
* '''Use exponential backoff''': Detect HTTP 429 responses in your | |||
application, then retry with progressively longer delays (e.g., 2s → 4s → 8s) until the request succeeds or a maximum retry count is reached. | |||
== 502 Bad Gateway == | === 502 Bad Gateway === | ||
Cause: | |||
* | * A failure between upstream network devices/servers — not something the end user can fix directly. | ||
Fixes: | |||
* | * Hard-refresh the page to bypass the browser cache | ||
* Wait a moment and try again | |||
== Error 1020: Access Denied == | === Error 1020: Access Denied === | ||
* | * See the linked guide on resolving Error 1020 (Access Denied) to restore access to your website. | ||
== HTTP Cats or Dogs == | |||
: https://http.cat/200.jpg | <div style="zoom: 0.4;"> | ||
https://http.cat/200.jpg | |||
</div> | |||
From [https://http.cat/ HTTP Cats] | |||
Related websites | Related websites: | ||
* [https://httpstatusdogs.com/ HTTP Status Dogs] | * [https://httpstatusdogs.com/ HTTP Status Dogs] | ||
== Other | == Other possible root causes == | ||
* CDN ([https:// | * CDN (Content delivery network) | ||
== Mock HTTP status error page tools == | |||
The testing sites that can return 500 and various other HTTP status codes on demand | |||
* [https://the-internet.herokuapp.com/status_codes The Internet]<ref>[https://stackoverflow.com/questions/24736134/is-there-a-website-that-returns-500-and-other-http-response-codes-for-testing httpresponse - Is there a website that returns 500 (and other) HTTP response codes for testing? - Stack Overflow]</ref> | |||
* [https://httpstatus.io/ httpstatus.io]: A bulk checker for HTTP status codes, headers, and redirects, which also offers mock endpoints, e.g. [https://mock.httpstatus.io/500 500] | |||
* [https://www.postman.com/postman/published-postman-templates/documentation/ae2ja6x/postman-echo Postman Echo]: A request/response testing service with status code endpoints, e.g. [https://postman-echo.com/status/500 500] | |||
== Related pages == | == Related pages == | ||
| Line 84: | Line 95: | ||
{{Template:Troubleshooting}} | {{Template:Troubleshooting}} | ||
[[Category:Programming]] | [[Category: Web server]] [[Category:Programming]] [[Category:Web scraping]] | ||
[[Category:Web scraping]] | |||