HTTPステータスコード&レスポンスヘッダー
公式 RFC 9110 / RFC 9111 準拠の 1xx〜5xx 全レスポンスコード仕様、キャッシュ制御ディレクティブ、401/403 権限切り分け・502 障害対処ガイド、ブラウザ完結の生ヘッダー解析ツール。
アクセス禁止・権限なし (Forbidden)
仕様と意味論 (RFC)
Indicates that the server understood the request but refuses to authorize it. Unlike 401 Unauthorized, re-authenticating with the same credentials will make no difference because the user's role, IP, WAF, or scopes do not have permission for the resource.
主な発生原因
- •User is authenticated, but lacks 'admin' or required RBAC permission scope.
- •CORS Preflight origin blocked or forbidden.
- •Cloudflare WAF / AWS Shield IP geo-blocking rule triggered.
- •Missing CSRF token on state-changing POST request.
- •File permission 403 Forbidden on Linux Nginx (worker user cannot read static folder).
推奨トラブルシューティング&修正手順
生HTTPレスポンスプレビュー
HTTP/1.1 403 Forbidden Content-Type: application/json Content-Length: 104 { "error": "forbidden", "message": "You lack the required 'billing:write' permission scope." }
主要フレームワーク実装コード
if (!req.user.roles.includes('admin')) {
return res.status(403).json({ error: 'Insufficient permissions' });
}生 HTTP レスポンスヘッダー解析シミュレーター
生の HTTP レスポンスヘッダーをブラウザ内でパースし、キャッシュ挙動・セキュリティヘッダー・CORS 整合性をリアルタイム診断。
成功 (OK)
RFC標準仕様に準拠したステータスコード
Actively cacheable (3600s browser, 86400s shared CDN). Stale responses tolerated for 60s while revalidating in background.
Security & Hardening Headers Audit
max-age=63072000; includeSubDomains; preload
Missing. Crucial for defending against cross-site scripting (XSS) and unwanted injection scripts.
nosniff
DENY
strict-origin-when-cross-origin
Configured: '*' (Wildcard allows all websites)
パース済みヘッダー詳細一覧 (10)
| ヘッダー名 | 設定値 | RFC規格上の意味 |
|---|---|---|
| Date | Sun, 11 Oct 2026 21:30:00 GMT | Standard HTTP response header |
| Content-Type | application/json; charset=utf-8 | MIME media type and character encoding of response body payload. |
| Cache-Control | public, max-age=3600, s-maxage=86400, stale-while-revalidate=60 | Defines browser and CDN caching policies, TTL, and revalidation instructions. |
| ETag | W/"68a41bf-304e" | Entity tag used as fingerprint for conditional cache validation (304 Not Modified). |
| Vary | Accept-Encoding | Standard HTTP response header |
| Strict-Transport-Security | max-age=63072000; includeSubDomains; preload | Enforces HTTPS connections, prevents SSL-stripping man-in-the-middle attacks. |
| X-Content-Type-Options | nosniff | Prevents MIME-sniffing vulnerabilities (recommended: 'nosniff'). |
| X-Frame-Options | DENY | Defends against clickjacking by controlling whether site can be framed. |
| Referrer-Policy | strict-origin-when-cross-origin | Regulates how much referrer information is sent along with outbound requests. |
| Access-Control-Allow-Origin | * | Cross-Origin Resource Sharing (CORS) access control parameter. |
403 Forbidden と 401 Unauthorized の違い
REST API設計における最大の論点: 認証 (あなたは誰か?) と 認可 (何を実行できるか?) の厳格な使い分け。
「あなたが誰なのか確認できません!」
認証情報が存在しない、期限切れ、または暗号検証に失敗。クライアントは未認証状態です。
「あなたが誰かは分かりましたが、アクセスは許可されません!」
本人は認証済みですが、対象リソースに必要なロール・権限スコープ・IP許可を持っていません。
本番環境で多発する注意すべき不具合:
JWTトークンが存在しない場合に403を返すと、フロントエンドのインターセプターが未認証を検知できず、ログイン画面へ自動遷移できずに画面がフリーズしたように見えてしまいます。トークンなし・期限切れには必ず「401」を返してください。
502 Bad Gateway の原因究明と復旧手順
Linux、Nginx、Docker、Node.js、Cloudflare環境における段階的トラブルシューティング。
Node.js、Python、PHP等のアプリケーションが正常に起動しているか確認:
systemctl status my-app pm2 status docker ps
Nginxがプロキシ先に指定しているポート (例: 3000) でアプリが待受しているか確認:
ss -tulpn | grep :3000 netstat -tulpn | grep 3000
Nginxのエラーログから接続拒否やソケット異常の直接原因を特定:
tail -f /var/log/nginx/error.log # Look for "(111: Connection refused)"
RHELやCentOSではSELinuxがデフォルトでNginxの外部ソケット接続を遮断します:
setsebool -P httpd_can_network_connect 1 chmod 755 /var/run/app.sock
リダイレクト比較表: 301 / 302 / 307 / 308 の違い
HTTPメソッドの保持 (POSTがGETに変異するか) とSEO被リンク評価の引き継ぎに関する完全比較。
| ステータスコード | 恒久性 | POSTメソッド保持? | ブラウザキャッシュ | SEOリンク評価継承 |
|---|---|---|---|---|
| 301 恒久的に移動 (Moved Permanently) | 恒久的 (Permanent) | 不可 (POSTがGETに変異) | 強力にキャッシュ | 100% 評価を引き継ぐ |
| 302 一時的に移動 (Found) | 一時的 (Temporary) | 不可 (POSTがGETに変異) | 標準では非キャッシュ | 転送元URLに留まる |
| 307 一時的リダイレクト (Temporary Redirect) | 一時的 (Temporary) | 保持 (POSTを厳格維持) | キャッシュされない | 転送元URLに留まる |
| 308 恒久リダイレクト (Permanent Redirect) | 恒久的 (Permanent) | 保持 (POSTを厳格維持) | 強力にキャッシュ | 100% 評価を引き継ぐ |
API ステータスコード選定ウィザード
エンドポイントの処理結果に最適な、意味論的に正しい HTTP ステータスコードを導く対話型決定ツリー。
ステップ 1: クライアントのリクエスト処理は成功しましたか?
RFC 9110 / 9111 完全準拠
最新の IETF 公式セマンティクスに準拠。キャッシュ制御、冪等性、安全メソッドの厳密な契約仕様を提供します。
実践的な障害原因特定ガイド
401 (認証) と 403 (認可) の違い、502 (Bad Gateway) や 504 (Timeout) のプロキシ障害原因を体系的に解説。
完全ローカル解析・外部送信ゼロ
ヘッダー解析や診断はすべてブラウザメモリ上で実行。トークン、Cookie、内部データが外部サーバーへ漏洩することはありません。
HTTPステータスコード&レスポンスヘッダー — 技術リファレンス
RFC 9110最新セマンティクスに準拠した1xx〜5xxのHTTPステータスコード完全辞書。キャッシュ制御、401/403識別、502/504障害切り分けを徹底解説。
HTTPステータスコード一覧・早見表
主要なHTTPステータスコード(200、301、404、500など)、RFC標準仕様、キャッシュ可否とハンドリング方針一覧です。
| ステータスコード | 理由フレーズ | クラス区分 | RFC仕様 | キャッシュ可否 | 主な意味と対処方針 |
|---|---|---|---|---|---|
| 200 | OK | 2xx Success | RFC 9110 §15.3.1 | Yes (default) | Request succeeded; entity payload returned in response body. |
| 201 | Created | 2xx Success | RFC 9110 §15.3.2 | Yes | New resource successfully created; URI typically returned in Location header. |
| 204 | No Content | 2xx Success | RFC 9110 §15.3.5 | Yes | Action succeeded; response body intentionally empty (common for DELETE/PUT). |
| 301 | Moved Permanently | 3xx Redirection | RFC 9110 §15.4.2 | Yes (default) | Target resource assigned permanent new URI; search engines transfer link equity. |
| 302 | Found (Temp Redirect) | 3xx Redirection | RFC 9110 §15.4.3 | No (unless header) | Resource temporarily resides at different URI; client keeps requesting original URL. |
| 304 | Not Modified | 3xx Redirection | RFC 9110 §15.4.5 | N/A | Conditional GET match (ETag / If-Modified-Since); client uses local cached copy. |
| 307 | Temporary Redirect | 3xx Redirection | RFC 9110 §15.4.8 | No | Redirect with guaranteed method preservation (POST remains POST, not GET). |
| 308 | Permanent Redirect | 3xx Redirection | RFC 9110 §15.4.9 | Yes (default) | Permanent redirect with guaranteed method preservation across redirects. |
| 400 | Bad Request | 4xx Client Error | RFC 9110 §15.5.1 | No | Malformed syntax, invalid JSON schema, or missing mandatory query parameters. |
| 401 | Unauthorized | 4xx Client Error | RFC 9110 §15.5.2 | No | Authentication required; client must provide valid Bearer token or credentials. |
| 403 | Forbidden | 4xx Client Error | RFC 9110 §15.5.4 | No | Authenticated identity lacks RBAC permissions to access resource; do not retry. |
| 404 | Not Found | 4xx Client Error | RFC 9110 §15.5.5 | Yes | Origin server cannot find current representation for target resource. |
| 409 | Conflict | 4xx Client Error | RFC 9110 §15.5.10 | No | State conflict (e.g. unique constraint violation, optimistic lock mismatch). |
| 429 | Too Many Requests | 4xx Client Error | RFC 6585 §4 | No | Rate limit quota exceeded; client must back off until Retry-After timestamp. |
| 500 | Internal Server Error | 5xx Server Error | RFC 9110 §15.6.1 | No | Unhandled server-side runtime exception or backend service crash. |
| 503 | Service Unavailable | 5xx Server Error | RFC 9110 §15.6.4 | No | Server temporarily overloaded or down for scheduled maintenance. |
主要パラメータと設定項目
| パラメータ | 型・単位 | 説明 | 初期値 |
|---|---|---|---|
| ステータスコード検索 | string / number | ステータスコード番号(404、502など)または意味・フレーズによるリアルタイムフィルタリング。 | 403 |
| ステータスクラス選択 | string | 1xx(情報)、2xx(成功)、3xx(リダイレクト)、4xx(クライアントエラー)、5xx(サーバーエラー)、エッジプロキシコード別の絞り込み。 | all |
| キャッシュ可否フィルター | string | RFC 9111に準拠したキャッシュ特性(キャッシュ可能、非キャッシュ、条件付きキャッシュ)による抽出。 | all |
現場のベストプラクティス・実践Tips
2022年に改定されたRFC 9110は従来のRFC 7231やRFC 2616を正式に置き換え、HTTP/1.1、HTTP/2、HTTP/3における統一セマンティクスを定義しています。
認証されていないアクセスには必ず401を返しWWW-Authenticateヘッダーを付与します。認証済みだが権限スコープが不足している場合は403を返します。
入力されたHTTPヘッダーやAPIトークンはすべてブラウザのメモリ内でのみ解析されます。外部サーバーへの通信やテレメトリ送信は一切発生しません。
よくある落とし穴とトラブルシューティング
⚠️リバースプロキシにおける502 Bad Gatewayと504 Gateway Timeoutの違い
502はバックエンドサーバーがクラッシュしたか接続を即時リセットした場合に発生します。504はバックエンド処理がタイムアウト上限(例: 60秒)を超過した場合に返されます。
⚠️301および308恒久リダイレクトのブラウザキャッシュ滞留
301や308はブラウザに強力にキャッシュされるため、開発時やAPI移行フェーズでは302(Found)や307(Temporary Redirect)を採用してください。
よくある質問 (FAQ)
なぜRFC 9110が旧規格RFC 7231やRFC 2616を置き換えたのですか?▼
RFC 9110はHTTP/1.1からHTTP/3(QUIC)までの全バージョンで曖昧さを排除し、RFC 9111によるキャッシュ仕様の再整理とメソッド等価性を明確化するために策定されました。
401 UnauthorizedではなぜWWW-Authenticateヘッダーが必須なのですか?▼
RFC 9110 §15.5.2により、401を返すオリジンサーバーはクライアントに対して要求する認証スキーム(Bearer、Basicなど)とレルムをWWW-Authenticateで明示することが義務付けられています。
301 Moved Permanentlyと308 Permanent Redirectの違いは何ですか?▼
301は歴史的にクライアントがPOSTをGETに書き換える動作が許容されていました。308(RFC 7538)は元のHTTPメソッドとリクエストボディの完全保持を強制する恒久リダイレクト規格です。
本ツールに貼り付けたレスポンスヘッダーは安全ですか?▼
はい。ToolsAAは完全クライアントサイド実行('use client')を採用しており、貼り付けたCookieやトークン、ヘッダー情報が外部サーバーへ送信されることは一切ありません。
関連ツール&ユーティリティ
全ツール一覧 →HTTPステータスコードの確認、リダイレクトチェーン(多段転送)の追跡、レスポンスヘッダーの解析をリアルタイム実行。1xx〜5xxのエラー原因、RFC仕様、SEO検索評価への影響、復旧手順をブラウザ完結で診断します。
Nginx および Apache のアクセスログを生データからローカル環境で直接解析。ステータスコード分布、リクエスト上位URL、ユニーククライアントIP、転送帯域幅、カスタム正規表現パターンマッチングに対応。
生の cURL コマンドを Go 言語の標準ライブラリ net/http、fasthttp、go-resty の堅牢なコードへ変換。defer resp.Body.Close() 接続保護と完全ローカル実行。
cURLリクエストをNet::HTTP、URI、Faraday、HTTPartyなどのクリーンで実用的なネイティブRubyコードへ瞬時に変換します。
IEC 60062規格に準拠し、3・4・5・6本帯の抵抗カラーコードを双方向で瞬時に計算・判読。許容差範囲、温度係数(TCR)ドリフト、E系列の逆算合成、SMD相当コードまで高精度に算出します。
リバースプロキシ、自動HTTPS、圧縮、セキュリティヘッダー、基本認証を備えた最新のCaddy 2サーバー設定を生成します。