API リクエストでクライアント IP アドレスを正確に特定することは、Apigee 内の一部の機能(アナリティクスや、不正使用の検出やセキュリティ アクションなどの Advanced API Security 機能など)にとって重要です。
プロキシとロードバランサを使用する最新のネットワーク アーキテクチャでは、これらの中間プロキシによって実際の送信元 IP アドレスが不明になる可能性があるため、クライアント IP の識別プロセスは困難です。
この課題を克服するために、Apigee は環境レベルの設定で X-Forwarded-For(XFF)ヘッダーからクライアント IP アドレスを解決する方法を指定し、ネットワーク トポロジとセキュリティ要件の IP アドレスに一致するヘッダー内のインデックスを特定します。この設定を使用すると、環境内のすべてのリクエストでクライアント IP アドレスがどのように決定されるかを可視化し、一貫性を確保して制御できます。これにより、環境内の Advanced API Security、フロー変数、分析変数でクライアント IP アドレスが常に一貫して識別されます。
このページで説明するように環境レベルのクライアント IP 解決が構成されていない場合、クライアント IP アドレス変数には、デフォルトのクライアント IP アドレス解決の動作に従って値が設定されます。
デフォルトのクライアント IP アドレスの解決
クライアント IP 解決が環境レベルで構成されていない場合、ax_resolved_client_ip ディメンションのデフォルト値は、アナリティクスのディメンションの説明に従って計算されます。
環境でクライアント IP 解決が構成されている場合、フロー変数とアナリティクス変数はクライアント IP 解決構成から設定されます。環境のクライアント IP 解決を設定するをご覧ください。
環境のクライアント IP 解決を設定するタイミング
クライアント IP 解決を設定する必要はありませんが、デフォルトのクライアント IP アドレス解決がニーズを満たさず、アナリティクス、Advanced API Security、またはクライアント IP アドレスに関する一貫した信頼できる情報を必要とする他の機能を実行するために、指定されたクライアント IP アドレス解決のオーバーライドが必要になることがあります。
[Proxy Request Flow Started] の直前の [FlowInfo] を確認します。このセクションには、構成されたクライアント IP アドレスがキャプチャされます。
FlowInfo で次の変数を探します。
client_ip_resolution.resolved.ip: 解決されたクライアント IP アドレス。
client_ip_resolution.used.fallback: ブール値構成されたクライアント IP 解決を使用できないために Apigee がデフォルトのクライアント IP 解決にフォールバックしない限り、この値は false です。たとえば、構成された解決策で、ヘッダーに存在しないインデックスが指定されている場合です。
client_ip_resolution.algorithm: クライアント IP アドレスの特定に使用されるアルゴリズム。構成されている場合は "HeaderIndexAlgorithm{IpHeaderName:header_name, IpHeaderIndex: $header_index}" です。それ以外の場合は、default が表示されます。
制限事項
環境レベルのクライアント IP 解決には、次の制限が適用されます。
クライアント IP 解決構成の更新が有効になるまでに、最大で 5 分かかることがあります。
クライアント IP 解決構成を頻繁に変更(5 分ごとなど)しないでください。パフォーマンスが低下する可能性があります。
Apigee ハイブリッドの環境のクライアント IP 解決構成を設定するには、ハイブリッド バージョン 1.14.0 以降が必要です。
この構成は Apigee コンソールまたは API で確認できますが、設定できるのは API 経由のみです。
悪意のあるユーザーがいない場合でも、X-Forwarded-For リストは、各プロキシが正しい情報をリストに追加することを前提としています。この完全なリストは Apigee の管理と制御の範囲外であるため、クライアント IP 解決構成を設定しても、正しいリクエスト IP アドレスが特定されるとは限りません。
[[["わかりやすい","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-18 UTC。"],[[["\u003cp\u003eThis page provides guidance on how to accurately identify the client IP address in API requests within Apigee and Apigee hybrid, which is crucial for features like Analytics and Advanced API Security.\u003c/p\u003e\n"],["\u003cp\u003eApigee supports configuring environment-level client IP resolution using the X-Forwarded-For (XFF) header to handle challenges posed by proxies and load balancers that may obscure the true originating IP address.\u003c/p\u003e\n"],["\u003cp\u003eThe client IP resolution configuration uses an \u003ccode\u003eipHeaderName\u003c/code\u003e (currently only X-Forwarded-For) and an \u003ccode\u003eipHeaderIndex\u003c/code\u003e to specify how to extract the client IP from the header, allowing selection from either the left or right side of the address list.\u003c/p\u003e\n"],["\u003cp\u003eIf the client IP resolution is not configured at the environment level, the default client IP address resolution method is applied, but it can be overridden to provide a more precise identification method.\u003c/p\u003e\n"],["\u003cp\u003eAfter setting a client IP resolution, changes can take up to 5 minutes to be applied, updates should not be frequent, and the config can be seen but only set using the API.\u003c/p\u003e\n"]]],[],null,["# Client IP resolution\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\nAccurately identifying the client IP address on API requests is important for some functionality\nwithin Apigee, including\n[Analytics](/apigee/docs/api-platform/analytics/analytics-services-overview) and\n[Advanced API Security](/apigee/docs/api-security)\nfeatures such as abuse detection and security actions.\n\nThe client IP identification process is challenging in modern network architectures that employ proxies and load balancers, as\nthese intermediaries can obscure the true originating IP address.\n\nTo overcome this challenge, Apigee supports an environment-level setting specifying\nhow to resolve the client IP address from the X-Forwarded-For (XFF) header, identifying\nthe index in the header that matches the IP address for your network topology and security\nrequirements. Using this setting provides visibility, consistency, and control over how client IP addresses\nare determined for all requests in the environment and results in consistent client IP address identification\nacross Advanced API Security, flow variables, and analytics variables in the environment.\n\nIf the environment-level client IP resolution is not configured as described on this page, the\nclient IP address variables are populated using the\n[default client IP address resolution](#default-client-ip-address-resolution) behavior.\n\nDefault client IP address resolution\n------------------------------------\n\nIf client IP resolution is not configured at the environment level, the default value of the\n`ax_resolved_client_ip` dimension is calculated as described in\n[Analytics dimensions](/apigee/docs/api-platform/analytics/analytics-reference#dimensions).\n\nIf client IP resolution *is* configured for an environment, the flow and Analytics\nvariables are set from the client IP resolution configuration. See\n[Set the client IP resolution for an environment](#set-client-ip-resolution-for-an-environment).\n\nWhen to set the client IP resolution for an environment\n-------------------------------------------------------\n\nAlthough it's not required to set client IP resolution, you might want to if the\n[default client IP address resolution](#default-client-ip-address-resolution) does not\nmeet your needs and you want to override it to provide a specified client IP address\nresolution for Analytics, Advanced API Security, or performing any other function that requires\nconsistent and reliable information on client IP addresses.\n\nUnderstand the client IP resolution configuration syntax\n--------------------------------------------------------\n\nThe client IP resolution setting has this format: \n\n```\n\"clientIpResolutionConfig\": {\n \"headerIndexAlgorithm\": {\n \"ipHeaderName\" : \"X-Forwarded-For\",\n \"ipHeaderIndex\": 2\n }\n}\n```\nwhere\n\n- `ipHeaderName` is the header to use for the client IP. At this time, `X-Forwarded-For` is the supported header value.\n- `ipHeaderIndex` is the index value within the `ipHeaderName`. \n\n A positive number selects an address starting from the left (the first address added to the header), where the first position on the left is `0` and increases by one for each subsequent address (e.g. `0, 1, 2`). For example, if the list is `192.0.2.1, 192.0.2.2, 192.0.2.3`, an index of `1` resolves to `192.0.2.2`. \n\n A negative number selects an address starting from the right (the last address added to the header) where the first position on the right is `-1` and decrements by one for each subsequent address (e.g. `-3, -2, -1`). For example, if the list is `192.0.2.1, 192.0.2.2, 192.0.2.3, 192.0.2.4`, an index of `-1` resolves to `192.0.2.4` and the index `-2` resolves to `192.0.2.3`.\n\nSee the [organizations.environment API](/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments#Environment)\nfor additional information about this setting.\n\nView client IP resolution configurations\n----------------------------------------\n\nYou can view the current client IP resolution configuration for an environment using either\nthe Apigee UI or Management APIs.\n\n### View the client IP resolution configuration using the UI\n\nTo view the client IP resolution configuration:\n\n1. In the Google Cloud console, go to the **Management \\\u003e Environments** page.\n\n [Go to Environments](https://console.cloud.google.com/apigee/environments)\n2. Select the environment, and see **Client IP configuration** in\n the **About** tab.\n\n### View the client IP resolution configuration using the API\n\nTo use the Apigee Management APIs to view the client IP resolution configuration, send a request to the\n[organizations.environments.get API](/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments/get).\n\nSet client IP resolution for an environment\n-------------------------------------------\n\nAfter setting the client IP resolution configuration for an environment, the [`client.resolved.ip`](/apigee/docs/api-platform/reference/variables-reference#client)\nflow variable populates using the specified algorithm. So does the\n[`Resolved Client IP` Analytics dimension](/apigee/docs/api-platform/analytics/analytics-reference#dimensions).\n\nOnce you've set the client IP resolution configuration for an environment, the changes\nmight impact existing Advanced API Security configurations for security action rules. Review and, if necessary, regenerate\nexisting rules to use the new variables and settings.\n\nKeep these implications in mind when selecting the index for Client IP resolution:\n\n- Apigee to Apigee calls are not handled as a special case. Take care to note and skip the number of IPs accordingly.\n- Since the X-Forwarded-For header can be spoofed, it's better to use the right index based on the number of expected hops between the client and the Apigee load balancer. A malicious user can send a pre-filled X-Forwarded-For header. While the first IP in the XFF is closest to the actual client IP, the last IP in the XFF is most trustworthy, given the load balancer knows the TCP client which is connected to it.\n\nTo set client IP resolution on an environment, use one of the Apigee API Management APIs to set\nthe client IP resolution for the environment in the `client_ip_resolution_config`.\nUse\n[organizations.environments.create](/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments/create)\nfor new environments. Use\n[updateEnvironment](/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments/updateEnvironment) or\n[modifyEnvironment](/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments/modifyEnvironment)\nfor existing environments.\n\nTest the client IP address resolution\n-------------------------------------\n\nAfter saving a new client IP configuration, you can test it by following these instructions:\n\n1. Wait at least 5 minutes after saving a new configuration setting.\n2. Start a [debug session](/apigee/docs/api-platform/debug/trace). Enable the setting to **Show all FlowInfos**.\n3. Check the **FlowInfo** just before **Proxy Request Flow Started**. You should see the configured client IP address captured in that section.\n\nLook for these variables in the FlowInfo:\n\n- `client_ip_resolution.resolved.ip`: The resolved client IP address.\n- `client_ip_resolution.used.fallback`: Boolean. This value is `false` unless Apigee fell back to the default client IP resolution due to an inability to use a configured client IP resolution. For example, if the configured resolution specifies an index which doesn't exist in the header.\n- `client_ip_resolution.algorithm`: The algorithm used to determine the client IP address. If configured, this is `\"HeaderIndexAlgorithm{IpHeaderName:`\u003cvar translate=\"no\"\u003eheader_name\u003c/var\u003e`, IpHeaderIndex: `\u003cvar translate=\"no\"\u003e$header_index\u003c/var\u003e`}\"`. Otherwise, this shows `default`.\n\nLimitations\n-----------\n\nThese limitations apply to environment-level client IP resolution:\n\n- Updates to client IP resolution configurations can take up to 5 minutes to be effective.\n- Avoid frequent (for example, every 5 minutes) changes to the client IP resolution configuration, as this could cause performance degradation.\n- Setting the client IP resolution configuration for an environment in Apigee hybrid is available with hybrid versions 1.14.0 and later.\n- The configuration can be viewed via the Apigee Console or API but can be set only via the API.\n- Even in the absence of malicious users, the X-Forwarded-For list relies on each proxy to add the right information to the list. That complete list is outside Apigee's oversight and control, so setting the client IP resolution configuration does not guarantee identification of the correct request IP address."]]