Menu Close
8.7.10. 3scale Product カスタムリソースでのゲートウェイレスポンスの設定
3scale 管理者は、Product
カスタムリソースを設定して、その API プロダクトの公開された API へのリクエストに対するゲートウェイレスポンスを指定できます。CR のデプロイ後に、3scale はゲートウェイが指定したレスポンスおよびエラーメッセージを返すようにします。
Product
CR の gatewayResponse
オブジェクトには、ゲートウェイが返すレスポンスが含まれます。
手順
新規またはデプロイされた
Product
CR で、gatewayResponse
オブジェクトに 1 つ以上の応答を設定します。次の例は、userKey
と呼ばれる認証モードの Apacast ホスト型デプロイメントのレスポンス設定を示しています。apiVersion: capabilities.3scale.net/v1beta1 kind: Product metadata: name: product1 spec: name: "OperatedProduct 1" deployment: apicastHosted: authentication: userkey: gatewayResponse: errorStatusAuthFailed: 500 errorHeadersAuthFailed: "text/plain; charset=mycharset" errorAuthFailed: "My custom reponse body" errorStatusAuthMissing: 500 errorHeadersAuthMissing: "text/plain; charset=mycharset" errorAuthMissing: "My custom reponse body" errorStatusNoMatch: 501 errorHeadersNoMatch: "text/plain; charset=mycharset" errorNoMatch: "My custom reponse body" errorStatusLimitsExceeded: 502 errorHeadersLimitsExceeded: "text/plain; charset=mycharset" errorLimitsExceeded: "My custom reponse body"
ゲートウェイのレスポンスが含まれる
Product
CR をデプロイします。たとえば、product1.yaml
ファイルを更新した場合は、以下のコマンドを実行します。oc create -f product1.yaml
この例では、以下のような出力になります。
product.capabilities.3scale.net/product1 created