現在、Apigee Edge のドキュメントを表示しています。
Apigee X のドキュメントをご確認ください。 情報
クライアント: サーバー通信では、クライアントが提示した
HTTP リクエスト メソッドがサーバーでは認識されているものの、ターゲット リソースでサポートされていない場合、サーバーは HTTP ステータス コード 405
Method Not Allowed
で応答します。同様に、Apigee Edge では、バックエンド サーバーは HTTP ステータス コード 405 Method Not Allowed.
を返します。
Apigee Edge は、バックエンド サーバーが、仕様
RFC 7231、セクション 6.5.5: 405 Method Not Allowed に従い、許可されたメソッドのリストを Allow
ヘッダーに含めて 405 Method Not Allowed
レスポンスを送信することを想定しています。
Allow
ヘッダーは、次の形式で送信する必要があります。
Allow: HTTP_METHODS
たとえば、バックエンド サーバーで GET
、POST
、HEAD
の各メソッドが許可されている場合、次のように Allow
ヘッダーにこれらのメソッドが含まれていることを確認する必要があります。
Allow: GET, POST, HEAD
バックエンド サーバーが HTTP ステータス コード 405 Method Not Allowed,
の Allow
ヘッダーを送信しない場合、Apigee は、HTTP ステータス コード 502 Bad
Gateway
とエラーコード protocol.http.Response405WithoutAllowHeader
をクライアント アプリケーションに返します。このエラーに対処するための推奨される解決策は、
RFC 7231、セクション 6.5.5: 405 Method Not Allowed を遵守するようにバックエンド サーバーを修正するか、トラブルシューティング ハンドブックの
502 Bad Gateway - Response 4.05 で説明しているように、エラー処理を使用して、Allow
ヘッダーを含む HTTP ステータス コード 405 Method Not Allowed
で応答することです。
ただし、例外的に、バックエンドを修正したり、API プロキシを変更してこの問題に直ちに対処したりすることができない場合があります。
このような場合、Message Processor のレベルで 405
プロパティ HTTP.ignore.allow_header.for.405
の ignore allow ヘッダーを一時的に設定できます。このプロパティを true
に設定すると、バックエンド サーバーが Allow
ヘッダーなしで HTTP ステータス コード 405 Method Not Allowed
を送信した場合でも、Apigee はクライアント アプリケーションに 502 Bad Gateway
レスポンスを返しません。
Allow
ヘッダーを指定して HTTP ステータス コード 405 Method
Not Allowed
を送信するようにバックエンド サーバーを修正したら、プロパティ HTTP.ignore.allow_header.for.405
をデフォルト値の false
に戻すことができます。
始める前に
このドキュメントの手順を行う前に、次のトピックを理解しておいてください。
- ハンドブックを読む - 502 Bad Gateway - response 405 without Allow ヘッダー
- Private Cloud での Edge の構成方法に詳しくない場合は、Edge の構成方法をご覧ください。
Message Processor で 405 プロパティの ignore allow ヘッダーを true に設定する
Apigee Edge では、プロパティ HTTP.ignore.allow_header.for.405
はデフォルトで false
に設定されています。これにより、バックエンド サーバーが Allow
ヘッダーなしで HTTP ステータス コード 405 Method Not
Allowed
を送信した場合、Apigee Edge はエラーコード protocol.http.Response405WithoutAllowHeader
とともに 502 Bad
Gateway
をクライアント アプリケーションに返すことができます。Apigee Edge がクライアント アプリケーションに 502 Bad Gateway
を送信しないようにするには、Message Processor でプロパティ HTTP.ignore.allow_header.for.405
の値を true
に設定する必要があります。
このセクションでは、
Edge の構成方法で説明されている構文に従ってトークンを使用して、Message Processor のプロパティ HTTP.ignore.allow_header.for.405
を true
に構成する方法について説明します。
-
Message Processor マシンで、次のファイルをエディタで開きます。まだ存在しない場合は作成します。
/opt/apigee/customer/application/message-processor.properties
たとえば、 vi を使用してファイルを開くには、次のように入力します。
vi /opt/apigee/customer/application/message-processor.properties
- プロパティ ファイルに次の形式の行を追加します。
conf_http_HTTP.ignore.allow_header.for.405=true
- 変更を保存します。
- 次のように、プロパティ ファイルの所有者を
apigee
ユーザーにします。chown apigee:apigee /opt/apigee/customer/application/message-processor.properties
- 次のように Message Processor を再起動します。
/opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
- 複数の Message Processor がある場合は、すべての Message Processor で上記の手順を繰り返します。
Message Processor で 405 プロパティの ignore allow ヘッダーが true に設定されていることを確認する
このセクションでは、Message Processor のプロパティ HTTP.ignore.allow_header.for.405
が true
に正常に更新されていることを確認する方法について説明します。
トークン conf_http_HTTP.ignore.allow_header.for.405
を使用して Message Processor のプロパティ値を更新する場合でも、実際のプロパティ HTTP.ignore.allow_header.for.405
が true
に設定されていることを確認する必要があります。
- Message Processor マシンで、
/opt/apigee/edge-message-processor/conf
ディレクトリのプロパティHTTP.ignore.allow_header.for.405
を検索し、次のようにtrue
に設定されているかどうかを確認します。grep -ri "HTTP.ignore.allow_header.for.405" /opt/apigee/edge-message-processor/conf
- Message Processor でプロパティが正常に更新されると、次のように
http.properties
ファイルのプロパティHTTP.ignore.allow_header.for.405
の値がtrue
として表示されます。/opt/apigee/edge-message-processor/conf/http.properties:HTTP.ignore.allow_header.for.405=true
- それでもプロパティ
HTTP.ignore.allow_header.for.405
の値がfalse
の場合は、Message Processor で 405 プロパティの ignore allow ヘッダーを true に設定するで説明されているすべての手順が正しく行われていることを確認します。失敗した手順がある場合は、すべての手順を正しく繰り返します。 - それでもプロパティ
HTTP.ignore.allow_header.for.405
を変更できない場合は、Apigee Edge サポートにお問い合わせください。
Message Processor で 405 プロパティの ignore allow ヘッダーを false に設定する
このセクションでは、Edge の構成方法で説明されている構文に従ってトークンを使用して、Message Processor でプロパティ HTTP.ignore.allow_header.for.405
をデフォルト値 false
に構成する方法について説明します。
- プロパティ
HTTP.ignore.allow_header.for.405
がtrue
に変更されているかどうかを確認します。これを行うには、/opt/apigee/edge-message-processor/conf
ディレクトリでこのプロパティを検索し、次のコマンドを使用してその値を確認します。grep -ri "HTTP.ignore.allow_header.for.405" /opt/apigee/edge-message-processor/conf
- Message Processor でこのプロパティが
true
に設定されている場合、上記のコマンドにより、次のようにhttp.properties
ファイルのプロパティHTTP.ignore.allow_header.for.405
の値がtrue
として表示されます。/opt/apigee/edge-message-processor/conf/http.properties:HTTP.ignore.allow_header.for.405=true
- 上記のコマンドで、プロパティ
HTTP.ignore.allow_header.for.405
がfalse
(デフォルト値)に設定されていることが示されている場合、何もする必要はありません。つまり、次の手順をスキップします。 - プロパティ
HTTP.ignore.allow_header.for.405
がtrue
に設定されている場合は、次の手順でデフォルト値のfalse
に戻します。 Message Processor マシンで、次のファイルをエディタで開きます。
/opt/apigee/customer/application/message-processor.properties
たとえば、 vi を使用してファイルを開くには、次のように入力します。
vi /opt/apigee/customer/application/message-processor.properties
- プロパティ ファイルから次の行を削除します。
conf_http_HTTP.ignore.allow_header.for.405=true
- 変更を保存します。
- 次のように、プロパティ ファイルの所有者を
apigee
ユーザーにします。chown apigee:apigee /opt/apigee/customer/application/message-processor.properties
- 次のように Message Processor を再起動します。
/opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
- 複数の Message Processor がある場合は、すべての Message Processor で上記の手順を繰り返します。
Message Processor で 405 プロパティの ignore allow ヘッダーが false に設定されていることを確認する
このセクションでは、Message Processor のプロパティ HTTP.ignore.allow_header.for.405
が false
に正常に更新されていることを確認する方法について説明します。
トークン conf_http_HTTP.ignore.allow_header.for.405
を使用して Message Processor の値を更新する場合でも、実際のプロパティ HTTP.ignore.allow_header.for.405
が false
に設定されていることを確認する必要があります。
- Message Processor マシンで、
/opt/apigee/edge-message- processor/conf
ディレクトリのプロパティHTTP.ignore.allow_header.for.405
を検索し、次のようにfalse
に設定されているかどうかを確認します。grep -ri "HTTP.ignore.allow_header.for.405" /opt/apigee/edge-message-processor/conf
- Message Processor でプロパティが正常に更新されると、次のように
http.properties
ファイルのプロパティHTTP.ignore.allow_header.for.405
の値がfalse
として表示されます。/opt/apigee/edge-message-processor/conf/http.properties:HTTP.ignore.allow_header.for.405=false
- プロパティ
HTTP.ignore.allow_header.for.405
の値がtrue
と引き続き表示される場合は、 Message Processor で 405 プロパティの ignore allow ヘッダーを false に構成するに記載されているすべての手順が正しく行われていることを確認します。ステップを見逃した場合は、すべてのステップをもう一度正しくやり直します。 - それでもプロパティ
HTTP.ignore.allow_header.for.405
を変更できない場合は、Apigee Edge サポートにお問い合わせください。