8.9.10. 3scale 제품 사용자 정의 리소스에서 게이트웨이 응답 구성
3scale 관리자는 제품 사용자 지정 리소스를 구성하여 해당 API 제품에 대해 노출된 API 요청에 대한 게이트웨이 응답을 지정할 수 있습니다. CR을 배포한 후 3scale은 사용자가 지정한 응답 및 오류 메시지를 반환하도록 합니다.
Product CR에서 gatewayResponse 오브젝트에는 게이트웨이가 반환할 응답이 포함되어 있습니다.
절차
새 제품 또는 배포된
제품CR에서gatewayResponse오브젝트에서 하나 이상의 응답을 구성합니다. 다음 예제에서는userKey라는 인증 모드를 사용하여 Apicast 호스팅 배포에 대한 응답 구성을 보여줍니다.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"게이트웨이 응답이 포함된
ProductCR을 배포합니다. 예를 들어product1.yaml파일을 업데이트한 경우 다음 명령을 실행합니다.oc create -f product1.yaml주어진 예에서 출력은 다음과 같습니다.
product.capabilities.3scale.net/product1 created