このページは、まだ日本語ではご利用いただけません。翻訳中です。
旧バージョンのドキュメントを参照しています。 最新のドキュメントはこちらをご参照ください。
kong.ip
Trusted IPs module.
This module can be used to determine whether or not a given IP address is
in the range of trusted IP addresses defined by the trusted_ips
configuration
property.
Trusted IP addresses are those that are known to send correct replacement addresses for clients (as per the chosen header field, for example X-Forwarded-*).
See the documentation on trusted IPs.
kong.ip.is_trusted(address)
Depending on the trusted_ips
configuration property,
this function returns whether a given IP is trusted or not.
Both ipv4 and ipv6 are supported.
Phases
- init_worker, certificate, rewrite, access, header_filter, response, body_filter, log
Parameters
-
address (
string
): A string representing an IP address.
Returns
-
boolean
:true
if the IP is trusted,false
otherwise.
Usage
if kong.ip.is_trusted("1.1.1.1") then
kong.log("The IP is trusted")
end