Nouplo

HTTPステータスコード

その番号の意味と、いつ返すか。

例を読み込むと入力と設定が一時的に変わります。元の内容に戻せます。

0文字
コード数
38
出力
1xx  情報 — リクエストを受け取り、処理を続けている
2xx  成功 — うまくいった
3xx  リダイレクト — 別の場所を見る
4xx  リクエストの誤り — たいていクライアント側で直せる
5xx  サーバーの誤り — クライアントは再試行するしかない

100  Continue (継続)
     Carry on sending the body; the headers were acceptable.
101  Switching Protocols (プロトコル切り替え)
     Agreed — usually the handshake into a WebSocket.
200  OK (成功)
     It worked, and the body is the answer.
201  Created (作成完了)
     It worked and something new exists; Location says where.
202  Accepted (受理)
     Taken in, not done yet. Nothing promises it will succeed.
204  No Content (内容なし)
     It worked and there is deliberately nothing to send back.
206  Partial Content (部分的な内容)
     Here is the range you asked for — how video seeking works.
301  Moved Permanently (恒久的に移動)
     Use the new address from now on; search engines move their index.
302  Found (一時的に別の場所)
     Temporarily elsewhere. Keep using this address.
303  See Other (別の場所を参照)
     Done — now GET that other address. The answer to a form POST.
304  Not Modified (未更新)
     Your copy is current; nothing is sent. The point of caching.
307  Temporary Redirect (一時的なリダイレクト)
     Like 302 but the method must not change.
308  Permanent Redirect (恒久的なリダイレクト)
     Like 301 but the method must not change.
400  Bad Request (不正なリクエスト)
     The request itself is malformed. Not the same as invalid data.
401  Unauthorized (未認証)
     Not authenticated. Misnamed: it means “who are you?”.
402  Payment Required (支払いが必要)
     Reserved for years, now used by some APIs for quota and billing.
403  Forbidden (禁止)
     Authenticated and still not allowed. “I know who you are; no.”
404  Not Found (見つからない)
     Nothing here, and nothing said about whether there ever was.
405  Method Not Allowed (許可されていないメソッド)
     The address exists; that verb does not work on it.
406  Not Acceptable (受理できない)
     Nothing can be produced that matches the Accept header.
408  Request Timeout (リクエストのタイムアウト)
     The client took too long to send it.
409  Conflict (競合)
     It clashes with the current state — an edit against a stale version.
410  Gone (削除済み)
     It was here and is deliberately gone. Stronger than 404.
413  Payload Too Large (リクエストが大きすぎる)
     The body is bigger than the server will take.
415  Unsupported Media Type (対応していないメディアタイプ)
     The Content-Type is not one this endpoint reads.
418  I'm a teapot (私はティーポット)
     A 1998 April Fools joke, in the standard, still implemented for fun.
422  Unprocessable Content (処理できない内容)
     Well formed, but the data fails validation. The one people want when they reach for 400.
425  Too Early (早すぎる)
     Refusing a replayable request sent in TLS early data.
428  Precondition Required (前提条件が必要)
     Send an If-Match so you do not overwrite somebody blindly.
429  Too Many Requests (リクエストが多すぎる)
     Rate limited. Retry-After says how long to wait.
431  Request Header Fields Too Large (ヘッダーが大きすぎる)
     Usually one enormous cookie.
451  Unavailable For Legal Reasons (法的な理由で利用不可)
     Blocked by law. The number is a Fahrenheit 451 joke.
500  Internal Server Error (サーバー内部エラー)
     Something threw. The catch-all, and a sign nothing more specific was chosen.
501  Not Implemented (未実装)
     The server does not support that method at all.
502  Bad Gateway (不正なゲートウェイ)
     A proxy got nonsense from upstream. Usually the app behind it is down.
503  Service Unavailable (サービス利用不可)
     Temporarily down or overloaded; Retry-After may say when.
504  Gateway Timeout (ゲートウェイのタイムアウト)
     A proxy waited for upstream and gave up.
507  Insufficient Storage (容量不足)
     No room to hold what was sent.

ファイルは端末の外に出ません

このツールはすべてブラウザ内で動作します。貼り付けた内容は端末内で処理され、サーバーには送信されないため、トークンや鍵、未公開の文章でも安心して使えます。

使用例

例:セール開始直後に届いたエラー番号を調べる — 503・502・504・429の違い

ネットショップのセールが0時に始まった直後、アクセスが集中し、お客さんや監視の通知から「503」「502」「504」「429」と番号だけが届きました。番号を1つずつ入れて意味を確かめます。名前には日本語の訳が付きますが、説明は英語なので、下の表には日本語の意味を添えました。

  1. 503 と入れると、Service Unavailable(サービス利用不可)の1件が出ます。
  2. 5xx(5 や 500 でも同じ)と入れると、500・501・502・503・504・507の6件が並びます。
  3. 言葉でも探せます:タイムアウト(timeout)で408と504、リトライ(retry)で429と503、プロキシ(proxy)で502と504が出ます。
番号 英語の正式名 意味
503 Service Unavailable一時的に止まっているか、混み合っている。いつ戻るかを Retry-After で伝えられる
502 Bad Gateway手前のプロキシが、奥のサーバーからまともな応答を受け取れなかった。奥のアプリが落ちていることが多い
504 Gateway Timeout手前のプロキシが、奥のサーバーの応答を待ちきれずに打ち切った
429 Too Many Requests回数制限にかかった。Retry-After で待つ時間を伝える
500 Internal Server Errorプログラムの中でエラーが起きた。ほかに合う番号が選ばれなかったときの受け皿

502と504は、手前の中継(プロキシ)が奥のアプリとうまくやり取りできなかったという知らせで、503と429は、サーバーが自分から「今は受けられない」と断った知らせです。混雑で受け付けを止めるなら、503に Retry-After を付けて返すのが「少し待ってから来てください」の伝え方です。

使い方

  1. 空のままにするとクラスごとの一覧が出ます。
  2. 番号を入れるとその1件が出ます(404では、間違えやすい410も並びます)。400や500のように00で終わる番号は、そのクラス全体が出ます。
  3. 4xxと入れるとそのクラス全体が出ます。
  4. 「リダイレクト」「タイムアウト」のような日本語でも、redirect のような英語でも探せます。名前には日本語の短い訳が付き、説明は英語です。

よくある質問

401と403はどう違いますか?
401は「あなたが誰か分からない」——認証してやり直してください。403は「誰かは分かっている、その上で駄目です」。401の名前がUnauthorized(認可されていない)なのに意味は未認証なので、逆に使われ続けています。
400と422はどちらを返すべきですか?
400はリクエストそのものが壊れているとき——JSONが不正、ヘッダが足りない。422は構文としては読めたが内容が検証に通らないときです。多くの人が400を使う場面は、実際には422です。
418とは何ですか?
1998年のエイプリルフールのジョークですが、実在のRFCに載っていて実装もされており、削除の提案が出ては却下されています。意味は「私はティーポットです」。
リダイレクトはどれを使えばいいですか?
恒久的に移転し検索エンジンにも移してほしいなら301、一時的なら302です。POSTがGETに変わっては困る場合は308と307を使います。この2つはそのためだけに存在します。
日本語の言葉で検索できますか?
できます。「リダイレクト」で301・302・303・307・308、「タイムアウト」で408と504、「キャッシュ」で304が出ます。英語の言葉(redirect、timeout、retry など)でも探せます。名前には日本語の短い訳が付きますが、説明は英語のままです。
500と入れたのに6件出てきます。
100・200・300・400・500のように00で終わる番号は、4xxと同じくクラスとして扱われ、そのクラスの全件が出ます。500 Internal Server Error は、その一覧のいちばん上にあります。
サーバーに送信されますか?
いいえ。ブラウザの中だけで動くので、入力した内容はお使いのパソコンから出ません。

関連ツール