IP Routing Policy
Description
The policy filters API requests originating from a set of IPs reaching the configured backend target. It supports IPs in the following formats:
-
CIDR (for example - a.b.c.d/x)
-
IP (a.b.c.d)
Only supports pre-processing of the API request.
Usage
Following are examples of the request routing according to the subnet or IP for the pre-processing configuration:
-
Routing by subnet:
123.45.0.0/16:targethost-us.example.com -
Routing by IP:
123.45.67.0:targethost-eu.example.com
Design and Implementation
Sequence Diagram

Implementation Details
-
The policy retrieves pre-inputs from the service configuration. The pre-input map maps the host name to the IPs.
-
If configured pre-inputs contain CIDR-format IPs, then the look-up is done against CIDR-format IPs.
-
The policy calls the IP Routing Service by passing the configured host name map to look up and replace the target host.
-
IP Routing Service checks whether the request contains an X-Forwarded-For header. If this header is not present in the request, the request is not routed.
-
If the request contains X-Forwarded-For, then the host name is retrieved from the pre-input map using the X-Forwarded-For value.
-
The target host is replaced by host configured in the pre-input configuration, and the request is sent to the customer backend. If that customer backend host is down or invalid, the request will fail.
-
No IP-based routing will occur if the IP is not configured in the pre-inputs.