HTTPステータスコード検索
HTTPステータスコードの包括的なリファレンス。ステータスコードの意味を検索し、レスポンスコードを理解し、HTTPエラーコードについて学びます。
Continue
The server has received the request headers and the client should proceed to send the request body.
Switching Protocols
The requester has asked the server to switch protocols and the server has agreed.
Processing
A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request.
Early Hints
Used to return some response headers before final HTTP message.
OK
The request is successful. The meaning of success depends on the HTTP method used.
Created
The request has been fulfilled and a new resource has been created.
Accepted
The request has been accepted for processing, but the processing has not been completed.
Non-Authoritative Information
The request was successful but the information may have been modified by a transforming proxy.
No Content
The server successfully processed the request but is not returning any content.
Reset Content
The server successfully processed the request but is not returning any content and requires the requester to reset the document view.
Partial Content
The server is delivering only part of the resource due to a range header sent by the client.
Multi-Status
Provides status for multiple independent operations.
Already Reported
The members of a DAV binding have already been enumerated in a preceding part of the multistatus response.
IM Used
The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
Multiple Choices
The request has more than one possible response. The user agent should choose one of them.
Moved Permanently
The URL of the requested resource has been changed permanently. The new URL is given in the response.
Found
The URL of the requested resource has been changed temporarily. Further changes in the URL might be made in the future.
See Other
The server sent this response to direct the client to get the requested resource at another URI with a GET request.
Not Modified
Used for caching purposes. The client can use cached version of the response.
Use Proxy
The requested resource is available only through a proxy.
Unused
This response code is no longer used and is reserved.
Temporary Redirect
The server sends this response to direct the client to get the requested resource at another URI with the same method.
Permanent Redirect
This means the resource is now permanently located at another URI.
Bad Request
The server could not understand the request due to invalid syntax.
Unauthorized
Authentication is required and has failed or has not yet been provided.
Payment Required
This response code is reserved for future use and was originally created for digital payment systems.
Forbidden
The client does not have access rights to the content; the server is refusing to give the requested resource.
Not Found
The server can not find the requested resource. This is the most common error on the internet.
Method Not Allowed
The request method is known by the server but is not supported by the target resource.
Not Acceptable
The server cannot produce a response matching the list of acceptable values defined in the request's headers.
Proxy Authentication Required
This is similar to 401 but authentication is required to be done by a proxy.
Request Timeout
The server timed out waiting for the request. The client did not produce a request within the time the server was prepared to wait.
Conflict
This response is sent when a request conflicts with the current state of the server.
Gone
The requested content has been permanently deleted from the server with no forwarding address.
Length Required
The server rejects the request because the Content-Length header field is not defined and the server requires it.
Precondition Failed
The client has indicated preconditions in its headers which the server does not meet.
Payload Too Large
The request entity is larger than limits defined by the server.
URI Too Long
The URI requested by the client is longer than the server is willing to interpret.
Unsupported Media Type
The media format of the requested data is not supported by the server.
Range Not Satisfiable
The range specified by the Range header field in the request cannot be fulfilled.
Expectation Failed
The expectation indicated by the Expect request header field cannot be met by the server.
I'm a teapot
This code was defined in 1998 as one of the traditional IETF April Fools' jokes.
Misdirected Request
The request was directed at a server that is not able to produce a response.
Unprocessable Entity
The request was well-formed but was unable to be followed due to semantic errors.
Locked
The resource that is being accessed is locked.
Failed Dependency
The request failed because it depended on another request and that request failed.
Too Early
Indicates that the server is unwilling to risk processing a request that might be replayed.
Upgrade Required
The server refuses to perform the request using the current protocol.
Precondition Required
The origin server requires the request to be conditional.
Too Many Requests
The user has sent too many requests in a given amount of time.
Request Header Fields Too Large
The server is unwilling to process the request because its header fields are too large.
Unavailable For Legal Reasons
The server is denying access to the resource as a consequence of a legal demand.
Internal Server Error
The server has encountered a situation it does not know how to handle.
Not Implemented
The request method is not supported by the server and cannot be handled.
Bad Gateway
The server, while acting as a gateway or proxy, received an invalid response from an upstream server.
Service Unavailable
The server is not ready to handle the request. Common causes are a server that is down for maintenance or is overloaded.
Gateway Timeout
The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
HTTP Version Not Supported
The HTTP version used in the request is not supported by the server.
Variant Also Negotiates
The server has an internal configuration error.
Insufficient Storage
The method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request.
Loop Detected
The server detected an infinite loop while processing the request.
Not Extended
Further extensions to the request are required for the server to fulfill it.
Network Authentication Required
The client needs to authenticate to gain network access.
HTTPステータスコード検索ツールの使い方
当サイトのHTTPステータスコード検索ツールは、すべてのHTTPステータスコードの包括的なリファレンスを提供します。これを使用して、任意のステータスコードに関する情報をすばやく見つけます:
- コード番号(「404」など)、ステータス名(「not found」など)、または説明のキーワードを入力してステータスコードを検索します
- カテゴリボタンを使用してカテゴリでフィルタし、情報、成功、リダイレクト、クライアントエラー、またはサーバーエラーコードのみを表示します
- ステータスコードカードをクリックして展開し、説明、一般的な使用例、RFCリファレンスなどの詳細情報を表示します
- コピーボタンを使用して、ドキュメント、コードコメント、またはAPI仕様で使用するためにステータスコードをコピーします
For more developer tools, check out our Toolbox homepage or explore related tools like our JSON Formatter and Hash Generator for API development workflows.
HTTPステータスコードとは?
HTTPステータスコード検索は、Web開発者、API設計者、およびWebテクノロジーを扱うすべての人にとって不可欠です。HTTPステータスコードは、WebサーバーがHTTPリクエストの結果を示すために返す3桁の数字です。これらのコードは、リクエストが成功したか、エラーが発生したか、または追加のアクションが必要かどうかに関する重要な情報を提供します。
WebサイトにアクセスしたりAPI呼び出しを行ったりすると、サーバーはリクエストされたリソースまたはエラーメッセージとともにHTTPステータスコードで応答します。ステータスコードは、最初の数字に基づいて5つの主要なカテゴリに分類されます:情報レスポンス(1xx)、成功レスポンス(2xx)、リダイレクト(3xx)、クライアントエラー(4xx)、およびサーバーエラー(5xx)。これらのコードを理解することは、開発者が問題をデバッグし、適切なエラー処理を実装し、より良いユーザーエクスペリエンスを作成するのに役立ちます。
HTTPステータスコードを知ることは、堅牢なWebアプリケーションとAPIを構築するために不可欠です。ステータスコードを適切に使用すると、エラー処理が改善され、デバッグが容易になり、APIドキュメントが向上し、エンドユーザーにとってより直感的なエラーメッセージを作成するのに役立ちます。当サイトのHTTPステータスコード検索ツールは、すべての標準および拡張ステータスコードの包括的なリファレンスを提供します。
The official HTTP status code specifications are defined in RFC 7231 and related RFC documents maintained by the Internet Engineering Task Force (IETF). For comprehensive documentation, refer to the MDN HTTP Status Codes reference.
HTTPステータスコードのカテゴリ
HTTPステータスコードは、5つの主要なカテゴリに分類されます。各カテゴリは、HTTP通信において特定の目的を果たします:
1xx Informational Responses
情報レスポンス(100-199)は、リクエストが受信され、プロセスが継続していることを示します。これらは、リクエスト処理フェーズで使用される暫定的なレスポンスです。例には、クライアントにリクエスト本文の送信を継続するように指示する100 Continueや、WebSocketなどの別のプロトコルにアップグレードするときに使用される101 Switching Protocolsがあります。
2xx Success Responses
成功レスポンス(200-299)は、リクエストが正常に受信され、理解され、受け入れられたことを示します。最も一般的な成功コードは200 OKで、リクエストが成功したことを意味します。その他の重要な成功コードには、201 Created(リソース作成用)、204 No Content(レスポンス本文なしの成功した操作用)、および206 Partial Content(ファイルダウンロードの範囲リクエスト用)があります。
3xx Redirection Responses
リダイレクトレスポンス(300-399)は、リクエストを完了するために追加のアクションを実行する必要があることを示します。これらのコードは、リソースが移動した場合や、別の場所を使用する必要がある場合に使用されます。一般的なリダイレクトコードには、301 Moved Permanently(永続的なURL変更とSEO用)、302 Found(一時的なリダイレクト)、および304 Not Modified(キャッシュ最適化用)があります。
4xx Client Error Responses
クライアントエラーレスポンス(400-499)は、リクエストにエラーがあったことを示します。これらのエラーはクライアントの責任であり、リクエストが不正、許可されていない、またはリクエストされたリソースが存在しないことを意味します。最も有名なクライアントエラーは404 Not Foundです。その他の重要なコードには、400 Bad Request(無効な構文)、401 Unauthorized(認証が必要)、403 Forbidden(許可が拒否されました)、および429 Too Many Requests(レート制限)があります。
5xx Server Error Responses
サーバーエラーレスポンス(500-599)は、サーバーが有効なリクエストを処理できなかったことを示します。これらのエラーはサーバーの責任であり、多くの場合、サーバー構成、データベース、またはアプリケーションロジックの問題を示しています。一般的なサーバーエラーには、500 Internal Server Error(一般的なサーバー障害)、502 Bad Gateway(アップストリームサーバーからの無効なレスポンス)、503 Service Unavailable(サーバーが一時的にダウン)、および504 Gateway Timeout(アップストリームサーバーのタイムアウト)があります。
最も一般的なHTTPステータスコードの説明
多数のHTTPステータスコードがありますが、Web開発では特定のコードがより頻繁に発生します。これらの一般的なコードを理解することは、効果的なデバッグとエラー処理に不可欠です:
200 OK
200 OKは、HTTPリクエストの標準的な成功レスポンスです。リクエストが成功し、レスポンスにリクエストされたリソースが含まれていることを示します。これは、成功したAPI呼び出しやWebページの読み込みで遭遇する最も一般的なステータスコードです。レスポンス本文には通常、リクエストされたデータ、HTML、JSON、またはその他のコンテンツタイプが含まれます。
201 Created
201 Createdは、リクエストの結果として新しいリソースが正常に作成されたことを示します。このコードは通常、新しいリソースを作成するPOSTリクエストへの応答として使用されます。レスポンスには通常、新しく作成されたリソースを指すLocationヘッダーが含まれます。これは、リソース作成エンドポイントのRESTful API設計における標準的な慣行です。
301 Moved Permanently
301 Moved Permanentlyは、リクエストされたリソースが新しいURLに永続的に移動したことを示します。これはSEOにとって重要であり、検索エンジンはインデックスを更新して新しい場所を指すようにします。301リダイレクトを実装する場合は、ブラウザと検索エンジンがこのリダイレクトを永続的にキャッシュするため、常に新しいURLが正しいことを確認してください。永続的なURLの変更、ドメインの移行、または重複コンテンツの統合にはこれを使用してください。
404 Not Found
404 Not Foundは、おそらく最も認識されているHTTPステータスコードです。サーバーがリクエストされたリソースを見つけられないことを示します。これは、リソースが永久になくなったこと(それは410 Goneになります)を意味するのではなく、指定された場所に存在しないことを意味します。一般的な原因には、リンク切れ、削除されたページ、正しくないURL、または欠落しているファイルがあります。エラーページを実装する場合は、ユーザーが探しているものを見つけるのに役立つ有益なナビゲーションオプションと検索機能を提供してください。
500 Internal Server Error
500 Internal Server Errorは、サーバー側で何か問題が発生したことを示す一般的なサーバーエラーですが、サーバーは問題の内容をより具体的に説明できませんでした。このコードは、予期しない条件が発生してサーバーがリクエストを処理できなかった場合に使用する必要があります。アプリケーションコードやサーバー構成に対処する必要がある問題を示しているため、デバッグの目的でこれらのエラーをサーバーに記録することが重要です。
API開発におけるHTTPステータスコード
RESTful APIを構築する際、正しいステータスコードの使用は基本的です。ステータスコードはAPI操作の結果を明確かつ一貫して伝えるため、APIの理解と統合が容易になります:
- 一貫性:API全体で適切なステータスコードを一貫して使用することで、開発者はAPIをより簡単に理解し統合できます。RESTの慣習とHTTP標準に従って、予測可能な動作を保証します。
- エラー処理:異なるステータスコードは、クライアントアプリケーションがエラーを適切に処理するのに役立ちます。4xxエラーはクライアント側で修正可能な問題(無効な入力など)を示し、5xxエラーはサーバーの介入が必要なサーバー側の問題を示します。
- ドキュメンテーション:APIエンドポイントが返す可能性のあるステータスコードを文書化することで、開発者は適切なエラー処理を実装できます。APIドキュメント、OpenAPI仕様、およびコード例にステータスコードを含めます。
- クライアント体験:適切に選ばれたステータスコードは、明確で実用的な情報を提供することでクライアント体験を向上させます。例えば、429 Too Many Requestsの応答にRetry-Afterヘッダーを含めることで、クライアントにリクエストを再試行するタイミングを具体的に示せます。
HTTPステータスコードのベストプラクティス
HTTPステータスコードのベストプラクティスに従うことで、WebアプリケーションとAPIの信頼性、保守性、ユーザビリティが向上します:
- 適切なコードを選択する:リクエストの結果を正確に反映するステータスコードを選択してください。エラー条件に200 OKを使用したり、クライアントエラーに500を使用したりしないでください。状況を正確に記述する最も具体的なコードを使用します。
- 詳細を提供する:エラーステータスコード(4xx、5xx)を返す際は、レスポンス本文に詳細なエラーメッセージを含めます。これにより、開発者は問題をデバッグし、より良いエラー処理機能を提供できます。エラーコード、説明、および可能な解決策を含めます。
- ログ記録と監視:監視とデバッグの目的で、すべての非2xxステータスコードをログに記録します。エラー率を追跡し、パターンを特定し、異常なエラースパイクに対するアラートを設定します。これにより、ユーザーに重大な影響を与える前に問題を特定できます。
- モニタリング:ステータスコードの監視を使用してアプリケーションの健全性を追跡します。5xxエラーの高い割合はサーバーの問題を示し、4xxエラーの高い割合はクライアント側の問題、APIの誤用、または注意が必要なドキュメントの問題を示す可能性があります。
一般的なステータスコードの問題のトラブルシューティング
HTTPステータスコードに基づいた問題のトラブルシューティング方法を理解することは、Web開発者とシステム管理者にとって不可欠なスキルです:
クライアントエラー(4xx):4xxエラーが発生した場合、リクエストの形式、認証情報、認可権限、およびリクエストされたリソースが存在するかを確認してください。リクエストヘッダー、クエリパラメータ、およびリクエスト本文の形式を確認します。一般的な修正には、URLの修正、適切な認証の提供、リクエスト構文の修正、リソースの存在確認が含まれます。
400 Bad Requestの場合、入力データを検証しリクエスト形式を確認します。401 Unauthorizedの場合、認証トークンまたは資格情報を確認します。403 Forbiddenの場合、ユーザー権限と認可ルールを確認します。404 Not Foundの場合、リソースURLと存在を確認します。429 Too Many Requestsの場合、レート制限を実装するか、再試行する前に待機します。
サーバーエラー(5xx):5xxエラーは調査が必要なサーバー側の問題を示します。サーバーログ、データベース接続、アプリケーションコード、サーバー構成、およびシステムリソースを確認してください。これらのエラーは通常、解決するために開発者またはシステム管理者の介入が必要です。
500 Internal Server Errorの場合、アプリケーションログで例外を確認し、データベース接続を検証し、最近のコード変更を確認します。502 Bad Gatewayの場合、アップストリームサーバーの健全性とプロキシ構成を確認します。503 Service Unavailableの場合、サーバーの容量を確認し、メンテナンス操作を確認し、リソースの制約を確認します。504 Gateway Timeoutの場合、アップストリームサーバーの応答時間とタイムアウト設定を確認します。