當(dāng)瀏覽者訪問一個(gè)網(wǎng)頁時(shí),瀏覽者的瀏覽器會向網(wǎng)頁所在服務(wù)器發(fā)出請求。當(dāng)瀏覽器接收并顯示網(wǎng)頁前,此網(wǎng)頁所在的服務(wù)器會返回一個(gè)包含HTTP狀態(tài)碼的信息頭(server header)用以響應(yīng)瀏覽器的請求。
英文版
When a visitor visits a webpage, the browser of the visitor makes a request to the server where the webpage is located. When the browser receives and displays the web page, the server on which the web page resides returns a server header containing the HTTP status code to respond to the browser's request.
http常見的HTTP狀態(tài)碼:
200 - 請求成功
301 - 資源(網(wǎng)頁等)被永久轉(zhuǎn)移到其它URL
404 - 請求的資源(網(wǎng)頁等)不存在
500 - 內(nèi)部服務(wù)器錯(cuò)誤
英文版
http common HTTP status code:
200 - The request was successful
301 - Resources (web pages, etc.) are permanently transferred to other URLs
404 - The requested resource (webpage, etc.) does not exist
500 - Internal server error
http狀態(tài)碼的分類
http狀態(tài)碼由三個(gè)十進(jìn)制數(shù)字組成,第一個(gè)十進(jìn)制數(shù)字定義了狀態(tài)碼的類型,后兩個(gè)數(shù)字沒有分類的作用。HTTP狀態(tài)碼共分為5種類型:分類描述
1**:信息,服務(wù)器收到請求,需要請求者繼續(xù)執(zhí)行操作
2**:成功,操作被成功接收并處理
3**:重定向,需要進(jìn)一步的操作以完成請求
4**:客戶端錯(cuò)誤,請求包含語法錯(cuò)誤或無法完成請求
5**:服務(wù)器錯(cuò)誤,服務(wù)器在處理請求的過程中發(fā)生了錯(cuò)誤
英文版
http status code classification
The http status code consists of three decimal digits. The first decimal digit defines the type of status code. The last two digits have no classification. HTTP status code is divided into 5 types: classification description
1 **: information, the server receives the request, the requester need to continue to operate
2 **: On success, the operation was successfully received and processed
3 **: Redirect, requires further action to complete the request
4 **: client error, request contains a syntax error or can not complete the request
5 **: server error, the server has encountered an error while processing the request
HTTP狀態(tài)碼表
100:繼續(xù)??蛻舳藨?yīng)繼續(xù)其請求
101:切換協(xié)議。服務(wù)器根據(jù)客戶端的請求切換協(xié)議。只能切換到更高級的協(xié)議,例如,切換到HTTP的新版本協(xié)議
2開頭的狀態(tài)碼
200:請求成功。一般用于GET與POST請求
201:已創(chuàng)建。成功請求并創(chuàng)建了新的資源
202:已接受。已經(jīng)接受請求,但未處理完成
203:非授權(quán)信息。請求成功。但返回的meta信息不在原始的服務(wù)器,而是一個(gè)副本
204:無內(nèi)容。服務(wù)器成功處理,但未返回內(nèi)容。在未更新網(wǎng)頁的情況下,可確保瀏覽器繼續(xù)顯示當(dāng)前文檔
205:重置內(nèi)容。服務(wù)器處理成功,用戶終端(例如:瀏覽器)應(yīng)重置文檔視圖。可通過此返回碼清除瀏覽器的表單域
206:部分內(nèi)容。服務(wù)器成功處理了部分GET請求
3開頭的狀態(tài)碼
300:多種選擇。請求的資源可包括多個(gè)位置,相應(yīng)可返回一個(gè)資源特征與地址的列表用于用戶終端(例如:瀏覽器)選擇
301:永久移動。請求的資源已被永久的移動到新URI,返回信息會包括新的URI,瀏覽器會自動定向到新URI。今后任何新的請求都應(yīng)使用新的URI代替
302:臨時(shí)移動。與301類似。但資源只是臨時(shí)被移動??蛻舳藨?yīng)繼續(xù)使用原有URI
303:查看其它地址。與301類似。使用GET和POST請求查看
304:未修改。所請求的資源未修改,服務(wù)器返回此狀態(tài)碼時(shí),不會返回任何資源??蛻舳送ǔ彺嬖L問過的資源,通過提供一個(gè)頭信息指出客戶端希望只返回在指定日期之后修改的資源
305:使用代理。所請求的資源必須通過代理訪問
306:已經(jīng)被廢棄的HTTP狀態(tài)碼
307:臨時(shí)重定向。與302類似。使用GET請求重定向
4開頭的狀態(tài)碼
400:客戶端請求的語法錯(cuò)誤,服務(wù)器無法理解
401:請求要求用戶的身份認(rèn)證
402:保留,將來使用
403:服務(wù)器理解請求客戶端的請求,但是拒絕執(zhí)行此請求
404:服務(wù)器無法根據(jù)客戶端的請求找到資源(網(wǎng)頁)。通過此代碼,網(wǎng)站設(shè)計(jì)人員可設(shè)置"您所請求的資源無法找到"的個(gè)性頁面
405:客戶端請求中的方法被禁止
406:服務(wù)器無法根據(jù)客戶端請求的內(nèi)容特性完成請求
407:請求要求代理的身份認(rèn)證,與401類似,但請求者應(yīng)當(dāng)使用代理進(jìn)行授權(quán)
408:服務(wù)器等待客戶端發(fā)送的請求時(shí)間過長,超時(shí)
409:服務(wù)器完成客戶端的PUT請求是可能返回此代碼,服務(wù)器處理請求時(shí)發(fā)生了沖突
410:客戶端請求的資源已經(jīng)不存在。410不同于404,如果資源以前有現(xiàn)在被永久刪除了可使用410代碼,網(wǎng)站設(shè)計(jì)人員可通過301代碼指定資源的新位置
411:服務(wù)器無法處理客戶端發(fā)送的不帶Content-Length的請求信息
412:客戶端請求信息的先決條件錯(cuò)誤
413:由于請求的實(shí)體過大,服務(wù)器無法處理,因此拒絕請求。為防止客戶端的連續(xù)請求,服務(wù)器可能會關(guān)閉連接。如果只是服務(wù)器暫時(shí)無法處理,則會包含一個(gè)Retry-After的響應(yīng)信息
414:請求的URI過長(URI通常為網(wǎng)址),服務(wù)器無法處理
415:服務(wù)器無法處理請求附帶的媒體格式
416:客戶端請求的范圍無效
417:服務(wù)器無法滿足Expect的請求頭信息
5開頭的狀態(tài)碼
500;服務(wù)器內(nèi)部錯(cuò)誤,無法完成請求
501:服務(wù)器不支持請求的功能,無法完成請求
502:充當(dāng)網(wǎng)關(guān)或代理的服務(wù)器,從遠(yuǎn)端服務(wù)器接收到了一個(gè)無效的請求
503:由于超載或系統(tǒng)維護(hù),服務(wù)器暫時(shí)的無法處理客戶端的請求。延時(shí)的長度可包含在服務(wù)器的Retry-After頭信息中
504:充當(dāng)網(wǎng)關(guān)或代理的服務(wù)器,未及時(shí)從遠(yuǎn)端服務(wù)器獲取請求
505:務(wù)器不支持請求的HTTP協(xié)議的版本,無法完成處理
506:由《透明內(nèi)容協(xié)商協(xié)議》(RFC 2295)擴(kuò)展,代表服務(wù)器存在內(nèi)部配置錯(cuò)誤:被請求的協(xié)商變元資源被配置為在透明內(nèi)容協(xié)商中使用自己,因此在一個(gè)協(xié)商處理中不是一個(gè)合適的重點(diǎn)。
507:服務(wù)器無法存儲完成請求所必須的內(nèi)容。這個(gè)狀況被認(rèn)為是臨時(shí)的。WebDAV (RFC 4918)
509:服務(wù)器達(dá)到帶寬限制。這不是一個(gè)官方的狀態(tài)碼,但是仍被廣泛使用。
510:獲取資源所需要的策略并沒有沒滿足。(RFC 2774)
英文版
HTTP Status Code Table (Version 1)
100: continue. Clients should continue their request
101: Switch the protocol. The server switches the protocol according to the client's request. You can only switch to more advanced protocols, for example, to switch to the new version of HTTP
2 The beginning of the status code
200: The request was successful. Generally used for GET and POST requests
201: Created. Successfully requested and created new resource
202: Accepted. Already accepted the request but did not process it
203: unauthorized information. The request is successful. But the meta-information returned is not a copy of the original server, but a copy
204: No content. The server processed successfully but did not return content. Without updating the page, make sure that the browser continues to display the current document
205: Reset content. If the server is successfully processed, the user terminal (for example, browser) should reset the document view. This return code can be used to clear the browser's form fields
206: part of the content. The server successfully processed part of the GET request
3 at the beginning of the status code
300: a variety of options. The requested resource can include multiple locations, and a list of resource features and addresses can be returned accordingly for the user terminal (eg, browser) to select
301: move permanently. The requested resource has been permanently moved to the new URI, the returned information will include the new URI, and the browser will automatically redirect to the new URI. Any new requests in the future should use the new URI instead
302: temporary move. Similar to 301. But resources are only temporarily moved. The client should continue to use the original URI
303: View other addresses. Similar to 301. View using GET and POST requests
304: unmodified. The requested resource is unmodified, and the server does not return any resources when it returns this status code. Clients typically cache accessed resources by providing a header that states that the client wants to return only those resources that were modified after the specified date
305: Use a proxy. The requested resource must be accessed through a proxy
306: HTTP status code that has been discarded
307: temporary redirect. Similar to 302. Use GET request redirection
4 The beginning of the status code
400: Client request syntax error, the server can not understand
401: The request asks the user for authentication
402: Reserved for future use
403: The server understands the request for the client, but refuses to execute the request
404: The server could not find the resource (web page) based on the client's request. With this code, a website designer can set a personalized page that says "The resource you requested can not be found."
405: The method in the client request is disabled
406: The server can not complete the request based on the content characteristics requested by the client
407: The request asks for the identity of the proxy, similar to 401, but the requester should use the proxy for authorization
408: The server waits for the client to send the request for too long, timeout
409: The server may complete the client's PUT request is likely to return this code, the server encountered a request conflict
410: The client requested resource no longer exists. 410 is different from 404, if the resource has been permanently deleted for the 410 code, the site designer can specify the new location of the resource with the 301 code
411: The server was unable to process the request message sent by the client without Content-Length
412: Client request information is a prerequisite error
413: The request is denied because the requested entity is too large for the server to process. To prevent continuous client requests, the server may close the connection. If only the server temporarily unable to deal with, it will contain a Retry-After response
414: Request URI is too long (URI is usually the URL), the server can not handle
415: The server was unable to process the media format attached to the request
416: Invalid client request range
417: The server can not satisfy Expect's request header information
5 The beginning of the status code
500; internal server error, unable to complete the request
501: The server does not support the requested functionality and can not complete the request
502: A server acting as a gateway or proxy receives an invalid request from a remote server
503: The server is temporarily unable to process the client's request due to overloading or system maintenance. The length of the delay can be included in the server's Retry-After header
504: act as a gateway or proxy server, did not get requests from the remote server in time
505: The server does not support the requested version of the HTTP protocol and can not complete the process
506: Expanded by Transparent Content Negotiation Protocol (RFC 2295), representing an internal configuration error on behalf of the server: The requested Negotiation Argument resource is configured to use itself in transparent content negotiation and is therefore not suitable in a negotiation process Focus.
507: The server can not store the content necessary to complete the request. This situation is considered temporary. WebDAV (RFC 4918)
509: The server reached the bandwidth limit. This is not an official status code, but is still widely used.
510: The strategy needed to get the resource is not missing. (RFC 2774)
作者: https://www.haotuiwang.cn/ 平頭哥SEO,原創(chuàng)不易,轉(zhuǎn)載時(shí)必須以鏈接形式注明作者和原始出處及本聲明。
申請創(chuàng)業(yè)報(bào)道,分享創(chuàng)業(yè)好點(diǎn)子。點(diǎn)擊此處,共同探討創(chuàng)業(yè)新機(jī)遇!