You can use the ip-filtering
policy to control access to your API by filtering IP addresses.
You can allow or deny a specific IP address or range of IP addresses with CIDR.
Whitelist mode excludes all IP addresses except the addresses included in the whitelist. Blacklist mode allows all IP addresses except the addresses included in the blacklist.
The blacklist takes precedence, so if an IP address is included in both lists, the policy rejects the request.
You can specify a host to be resolved and checked against the remote IP.
Note
|
When using domain name, the Gateway is performing DNS Lookup with the DNS server configured on the host by default. If you want to use a specific DNS server, you can configure it at the policy level. See Gateway for more information. |
You can configure the policy with the following options:
At the policy level, you can configure the following options:
Property | Required | Description | Type | Default |
---|---|---|---|---|
matchAllFromXForwardedFor |
No |
If set to |
boolean |
|
whitelistIps |
No |
A list of allowed IPs with or without CIDR notation (host is allowed) |
string list |
|
blacklistIps |
No |
A list of denied IPs with or without CIDR notation (host is allowed) |
string list |
|
lookupIpVersion |
No |
IP version to use to lookup host name. If you’re not sure your DNS server can handle multi-question requests (both V4 and V6) specify a version. |
enum [ |
|
"ip-filtering": {
"matchAllFromXForwardedFor": true,
"whitelistIps": [
"10.0.0.1",
"10.0.0.2/10",
"gravitee.io"
],
"blacklistIps": [
null
],
"lookupIpVersion": "IPV4"
}