tool::http-status-detail
405 Method Not Allowed
The HTTP method is not supported for this resource.
ステータスコード
405
名前
Method Not Allowed
カテゴリ
4xx詳細説明
HTTP 405 Method Not Allowedは、リクエストで使用されたHTTPメソッドが対象リソースで許可されていないことを示します。例えば、GETのみ許可されたエンドポイントにPOSTリクエストを送った場合に発生します。サーバーはAllowヘッダーに許可されたメソッドの一覧を必ず含める必要があります。
主な原因
- ▸読み取り専用APIにPOST、PUT、DELETEリクエストを送った場合
- ▸静的ファイルサーバーにPUTまたはDELETEリクエストを送った場合
- ▸APIルーターで特定メソッドが実装されていない場合
- ▸OPTIONS以外のメソッドでCORSプリフライトを試みた場合
解決方法
- 1.Allowヘッダーを確認して許可されているメソッドを使用してください
- 2.APIドキュメントでそのエンドポイントがサポートするメソッドを確認してください
- 3.サーバーのルーター設定でそのパスのメソッド許可リストを確認してください
- 4.REST APIなら適切なメソッドを使用してください(読取=GET、作成=POST)
関連HTTPヘッダー
AllowContent-Typeレスポンス例
HTTP/1.1 405 Method Not Allowed
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
{"error":"method_not_allowed","message":"POST method is not supported for this endpoint"}関連ステータスコード
400Bad RequestThe server could not understand the request due to invalid syntax.→401UnauthorizedAuthentication is required and has failed or not been provided.→402Payment RequiredReserved for future use; some services use it for payment walls.→403ForbiddenThe server refuses to fulfill the request (authenticated but unauthorized).→404Not FoundThe requested resource could not be found.→
ad · 300×250
// related tools