API 프록시는 백엔드 서비스를 위한 관리형 퍼사드입니다. 기본 API 프록시 구성은 ProxyEndpoint(API 프록시의 URL 정의)와 TargetEndpoint(백엔드 서비스의 URL 정의)로 이루어집니다.
Apigee는 이 패턴을 바탕으로 정교한 동작을 빌드할 수 있는 유연성을 제공합니다.
예를 들어 API가 클라이언트 요청을 백엔드 서비스로 보내기 전에 처리하는 방식을 제어하는 정책을 추가하거나 클라이언트로 전달하기 전에 백엔드 서비스에서 받은 응답을 조작할 수 있습니다. 서비스 콜아웃 정책을 사용하여 다른 서비스를 호출하고, 자바스크립트 코드를 추가하여 커스텀 동작을 추가하고, 백엔드 서비스를 호출하지 않는 API 프록시를 만들 수도 있습니다.
안티패턴
서비스 콜아웃을 사용하여 대상 엔드포인트로 가는 경로가 없는 API 프록시에서 백엔드 서비스를 호출하는 것은 기술적으로 가능하지만 외부 서비스 성능에 대한 분석 데이터가 손실될 수 있습니다.
대상 경로가 포함되지 않은 API 프록시는 요청 메시지를 TargetEndpoint로 전달할 필요가 없는 경우에 유용할 수 있습니다. 대신 ProxyEndpoint가 필요한 모든 처리를 수행합니다. 예를 들어 ProxyEndpoint는 API 서비스의 키/값 저장소에 대한 조회에서 데이터를 검색하고 백엔드 서비스를 호출하지 않고 응답을 반환할 수 있습니다.
하지만 프록시는 외부 서비스 동작에 대한 분석 정보(예: 처리 시간 또는 오류율)를 제공할 수 없으므로 외부 서비스의 성능을 평가하기 어렵습니다.
영향
오류 코드, 응답 시간, 목표 성능 등 외부 서비스와의 상호작용에 대한 분석 정보를 사용할 수 없습니다.
서비스 콜아웃을 호출하기 전이나 후에 요구되는 특정 로직은 전체 프록시 로직의 일부로 포함되므로 이해하고 재사용하기 어렵습니다.
권장사항
API 프록시가 단일 외부 서비스와만 상호작용하는 경우 프록시는 백엔드 서비스가 API 프록시의 대상 엔드포인트로 정의된 기본 디자인 패턴을 따라야 합니다. 대상 엔드포인트에 대한 라우팅 규칙이 없는 프록시는 ServiceCallout 정책을 사용하여 백엔드 서비스를 호출해서는 안 됩니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-21(UTC)"],[[["\u003cp\u003eThis documentation covers API proxies within Apigee and Apigee hybrid, which are managed facades for backend services, consisting of a ProxyEndpoint and a TargetEndpoint.\u003c/p\u003e\n"],["\u003cp\u003eWhile technically possible, using service callouts to invoke a backend service in an API proxy without a defined target endpoint results in the loss of analytics data regarding the performance of the external service.\u003c/p\u003e\n"],["\u003cp\u003eAn API proxy can be configured with a "null route" to create a "no target" proxy that does not invoke a backend service, but this configuration should not include service callouts.\u003c/p\u003e\n"],["\u003cp\u003eBest practice dictates that if an API proxy interacts with a single external service, it should define that service as the target endpoint, rather than relying on a no-target configuration with service callouts.\u003c/p\u003e\n"],["\u003cp\u003eService callouts are intended to support mashup scenarios, not to replace target endpoint invocation, as such, invoking a service callout in a no-target proxy should be avoided.\u003c/p\u003e\n"]]],[],null,["# Antipattern: Use Service Callout Policy to invoke a backend service in a No Target API Proxy\n\n*You're viewing **Apigee** and **Apigee hybrid** documentation.\nView [Apigee Edge](https://docs.apigee.com/api-platform/antipatterns/service-callout-no-target) documentation.*\n\n\nAn API proxy is a managed facade for backend services. A basic API proxy configuration consists of a\n[ProxyEndpoint](/apigee/docs/api-platform/fundamentals/understanding-apis-and-api-proxies)\n(defining the URL of the API proxy) and a\n[TargetEndpoint](/apigee/docs/api-platform/fundamentals/understanding-apis-and-api-proxies)\n(defining the URL of the backend service).\n\n\nApigee offers a lot of flexibility for building sophisticated behavior on top of this pattern.\nFor example, you can add policies to control the way the API processes a client request before sending\nit to the backend service, or manipulate the response received from the backend service before\nforwarding it to the client. You can invoke other services using\n[service callout policies](/apigee/docs/api-platform/reference/policies/service-callout-policy),\nadd custom behavior by adding [Javascript code](/apigee/docs/api-platform/reference/policies/javascript-policy),\nand even create an API proxy that doesn't invoke a backend service.\n\nAntipattern\n-----------\n\n\nUsing service callouts to invoke a backend service in an API proxy with no routes to a target endpoint\nis technically feasible, but results in the loss of analytics data about the performance of the\nexternal service.\n\n\nAn API proxy that does not contain target routes can be useful in cases where you do not need to forward\nthe request message to the TargetEndpoint. Instead, the ProxyEndpoint performs all necessary\nprocessing. For example, the ProxyEndpoint could retrieve data from a lookup to the API service's\nkey/value store and return the response without invoking a backend service.\n\n\nYou can define a [null Route](/apigee/docs/api-platform/reference/api-proxy-configuration-reference#proxyendpoint-nullroutes)\nin an API proxy, as shown here: \n\n```text\n\u003cRouteRule name=\"noroute\"/\u003e\n```\n\n\nA proxy using a null route is a \"no target\" proxy, because it does not invoke a target backend service.\n\n\nIt is technically possible to add a service callout to a no target proxy to invoke an external service, as shown in the example below: \n\n```world-of-warcraft-toc\n\u003c!-- /antipatterns/examples/service-callout-no-target-1.xml --\u003e\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n\u003cProxyEndpoint name=\"default\"\u003e\n \u003cDescription/\u003e\n \u003cFaultRules/\u003e\n \u003cPreFlow name=\"PreFlow\"\u003e\n \u003cRequest\u003e\n \u003cStep\u003e\n \u003cName\u003eServiceCallout-InvokeBackend\u003c/Name\u003e\n \u003c/Step\u003e\n \u003c/Request\u003e\n \u003cResponse/\u003e\n \u003c/PreFlow\u003e\n \u003cPostFlow name=\"PostFlow\"\u003e\n \u003cRequest/\u003e\n \u003cResponse/\u003e\n \u003c/PostFlow\u003e\n \u003cFlows/\u003e\n \u003cHTTPProxyConnection\u003e\n \u003cBasePath\u003e/no-target-proxy\u003c/BasePath\u003e\n \u003cProperties/\u003e\n \u003cVirtualHost\u003esecure\u003c/VirtualHost\u003e\n \u003c/HTTPProxyConnection\u003e\n \u003cRouteRule name=\"noroute\"/\u003e\n\u003c/ProxyEndpoint\u003e\n```\n\n\nHowever, the proxy cannot provide analytics information about the external service behavior (such as processing time or error rates), making it difficult to assess the performance of the external service.\n\nImpact\n------\n\n- Analytics information on the interaction with the external service ( error codes, response time, target performance, etc.) is unavailable\n- Any specific logic required before or after invoking the service callout is included as part of the overall proxy logic, making it harder to understand and reuse.\n\nBest Practice\n-------------\n\n\nIf an API proxy interacts with only a single external service, the proxy should follow the basic\ndesign pattern, where the backend service is defined as the target endpoint of the API proxy. A proxy\nwith no routing rules to a target endpoint should not invoke a backend service using the ServiceCallout policy.\n\n\nThe following proxy configuration implements the same behavior as the example above, but follows best\npractices: \n\n```carbon\n\u003c!-- /antipatterns/examples/service-callout-no-target-2.xml --\u003e\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n\u003cProxyEndpoint name=\"default\"\u003e\n \u003cDescription/\u003e\n \u003cFaultRules/\u003e\n \u003cPreFlow name=\"PreFlow\"\u003e\n \u003cRequest/\u003e\n \u003cResponse/\u003e\n \u003c/PreFlow\u003e\n \u003cPostFlow name=\"PostFlow\"\u003e\n \u003cRequest/\u003e\n \u003cResponse/\u003e\n \u003c/PostFlow\u003e\n \u003cFlows/\u003e\n \u003cHTTPProxyConnection\u003e\n \u003cBasePath\u003e/simple-proxy-with-route-to-backend\u003c/BasePath\u003e\n \u003cProperties/\u003e\n \u003cVirtualHost\u003esecure\u003c/VirtualHost\u003e\n \u003c/HTTPProxyConnection\u003e\n \u003cRouteRule name=\"default\"\u003e\n \u003cTargetEndpoint\u003edefault\u003c/TargetEndpoint\u003e\n \u003c/RouteRule\u003e\n\u003c/ProxyEndpoint\u003e\n```\n\n\nUse Service callouts to support mashup scenarios, where you want to invoke external services before\nor after invoking the target endpoint. Service callouts are not meant to replace target endpoint\ninvocation.\n\nFurther reading\n---------------\n\n- [Understanding APIs and API proxies](/apigee/docs/api-platform/fundamentals/understanding-apis-and-api-proxies)\n- [How to configure Route Rules](/apigee/docs/api-platform/reference/api-proxy-configuration-reference#proxyendpoint-howtoconfigurerouterules)\n- [Null Routes](/apigee/docs/api-platform/reference/api-proxy-configuration-reference#proxyendpoint-nullroutes)\n- [Service Callout policy](/apigee/docs/api-platform/reference/policies/service-callout-policy)"]]