Loading
Slack 관련 문의처가 Salesforce Help로 통합 및 변경됩니다.더 많이 읽기

Flex Gateway Usage: Diagnosing Unexpected High API Call Counts from 4xx Errors

게시 일자: Aug 12, 2026
상세 설명

You observe unexpectedly high API call counts reported for your Self-Managed Flex Gateway, even when expected application traffic is low or absent. Upon investigation, these high counts appear to be attributed to requests resulting in 4xx errors or targeting non-existent routes, rather than legitimate API invocations.

솔루션

CAUSE

Flex Gateway counts any access request received as an API call for usage reporting, regardless of whether the response is successful. This includes:
*   Health checks or load balancer probes. 
*   Keep-alive or Server-Sent Events (SSE) connection pings from client applications.
*   Requests targeting non-existent APIs or routes, which typically result in 4xx HTTP status codes (e.g., 404 Not Found).
*   Any other inbound traffic hitting the gateway, successful or not.

A common cause for unexpectedly high usage is unmanaged or misconfigured client systems, external API gateways, or monitoring tools repeatedly sending requests to non-existent endpoints or causing other 4xx responses on the Flex Gateway. Requests made by the built-in Health Check policy are an exception and do not count towards usage.

SOLUTION

To diagnose and mitigate unexpected high API call counts on your Flex Gateway, follow these steps:

1.  **Understand Flex Gateway API Call Definition:**
    An "Omni Gateway API call" is defined as any access request received by Anypoint Flex Gateway, regardless of whether the response to the request is successful. This definition includes all inbound traffic, such as health checks, load balancer probes, keep-alive pings, and requests to non-existent APIs (resulting in 4xx responses). The only exception is requests made by the built-in Health Check policy, which do not count for pricing purposes.

2.  **Inspect Flex Gateway Envoy Statistics:**
    Use the `flexctl check http` command to retrieve detailed Envoy statistics from your Flex Gateway instance. This will help identify the types of requests contributing to the usage.

    a.  Run the following command on your Flex Gateway host:
        ```bash
        flexctl check http -v 10 --unix-socket /var/tmp/mulesoft/flex-gateway/flex-gw-admin.sock http://localhost:8098/stats?filter=http.listener > flexctl-http-listener-stats.txt 2>&1
        ```
        *Note: Adjust `http://localhost:8098` to the actual listener address and port if different, and `/var/tmp/mulesoft/flex-gateway/flex-gw-admin.sock` to the correct admin socket path for your installation.*

    b.  Examine the `flexctl-http-listener-stats.txt` file for metrics related to request counts and errors. Pay close attention to lines similar to:
        *   `http.listener-<port>.downstream_rq_4xx: <count>`: Indicates the total number of requests resulting in 4xx HTTP status codes.
        *   `http.listener-<port>.no_route: <count>`: Indicates the number of requests that did not match any configured route.
        *   `http.listener-<port>.downstream_cx_total: <count>`: Represents the total number of downstream connections.

    If you observe high counts for `downstream_rq_4xx` or `no_route`, these are significant contributors to your reported API usage.

3.  **Identify the Source of Unwanted Traffic:**
    To pinpoint the origin of requests causing 4xx errors or hitting non-existent routes, configure a catch-all API and a Message Logging policy on your Flex Gateway:

    a.  **Create a Catch-All API:** In Anypoint Platform API Manager, define a new API instance for your Flex Gateway with a `BasePath` of `/`. This API will capture any traffic that doesn't match other specific API configurations.
    b.  **Apply a Message Logging Policy:** Attach a Message Logging policy to this catch-all API. Configure the policy to log relevant request attributes, such as:
        *   `#[attributes.remoteAddress]` (source IP address)
        *   `#[attributes.requestPath]` (the requested path)
        *   `#[attributes.headers]` (all request headers, which might contain `User-Agent` or other identifying information)
    c.  **Analyze Logs:** Monitor the Flex Gateway logs (e.g., using `journalctl -u flex-gateway` or your configured logging mechanism) for entries from the Message Logging policy on the catch-all API. This will help you identify the source IP addresses and specific request patterns of the unwanted traffic.

4.  **Mitigate Unwanted Traffic:**
    Once the source of the unexpected 4xx requests is identified, take appropriate action to stop them. This may involve:
    *   Correcting misconfigurations in client applications, external API gateways (e.g., Kong, Nginx, AWS ALB), or monitoring systems.
    *   Updating outdated or incorrect endpoint URLs.
    *   Implementing IP-based access controls or other filtering mechanisms at an upstream layer if the traffic is malicious or entirely unwanted.

APPLIES TO

*   MuleSoft Flex Gateway (Self-Managed)
*   Versions: 1.13.1 and later

 

Knowledge 기사 번호

005390950

 
로드 중
Salesforce Help | Article