HTTP status code === ###### tags: `HTTP` ###### tags: `HTTP`, `status code`, `frontend`, `200`, `201`, `400`, `403`, `500` <br> [TOC] <br> ## Overall - [[MDN Web Docs] HTTP 狀態碼](https://developer.mozilla.org/zh-TW/docs/Web/HTTP/Status) 1. 資訊回應 (Informational responses, 100–199), 2. 成功回應 (Successful responses, 200–299), 3. 重定向 (Redirects, 300–399), 4. 用戶端錯誤 (Client errors, 400–499), 5. 伺服器端錯誤 (Server errors, 500–599). - [[MDN Web Docs] HTTP response status codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) 1. Informational responses (100 – 199) 2. Successful responses (200 – 299) 3. Redirection messages (300 – 399) 4. Client error responses (400 – 499) 5. Server error responses (500 – 599) <br> <hr> <br> ## 200 ### 200 OK - [200 OK - HTTP - MDN Web Docs - Mozilla](https://developer.mozilla.org/zh-TW/docs/Web/HTTP/Status/200) <br> <hr> <br> ## 300 - [搞懂 http 3xx 重新導向狀態碼](https://medium.com/@dubiety/f1a288c1cd20) <br> <hr> <br> ## 400 ### 422 - 怎麼造成 1. 使用 FastAPI,request 未攜帶 `-H 'Content-Type: application/json'` - [422 Unprocessable Content - HTTP - MDN Web Docs - Mozilla](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422) The HyperText Transfer Protocol (HTTP) 422 Unprocessable Content response status code indicates that the server understands the content type of the request entity, and the syntax of the request entity is correct, but it was unable to process the contained instructions. <br> <hr> <br> ## 500 ### 502 - bad gatway - [502 Bad Gateway - HTTP - MDN Web Docs - Mozilla](https://developer.mozilla.org/zh-TW/docs/Web/HTTP/Status/502) - [Getting 502 Bad Gateway error while accessing users properties/methods using ArcGIS API for python on AGOL](https://community.esri.com/t5/arcgis-enterprise-extensibility-questions/getting-502-bad-gateway-error-while-accessing/td-p/1114816) - I am encountering 502 bad gateway error while collecting users properties or items properties. And when I increased the time interval of testing from one to three hours. The frequency of 502 bad gateway error got decreased. And finally when I increased the time interval to four hours the 502 bad gateway got disappeared. - I want to know that the error ( 502 bad gateway ) we were encountering Is it due to the request that we are making very frequently to AGOL or is it is due to something else? - 小結: - 當測試期間,從 1h 拉長到 3h,502 發生頻率有下降 - 當測試期間,拉長到 4h,502 發生頻率完全消失 - [[stackoverflow] 502 error using Requests to search website in Python](https://stackoverflow.com/questions/43239698/) - solution -> 沒效果,一樣遇到 502 (2023/11/15) ``` headers={'User-Agent': 'Mozilla/5.0'} ``` - [[wikimedia] User-Agent policy](https://meta.wikimedia.org/wiki/User-Agent_policy)