kimaai_trusted_proxies

When it fires

When KimaAI resolves the visitor’s IP address and the request carries an X-Forwarded-For header, once for each address in the chain it checks. KimaAI needs the address for the daily message limit, the banned IP addresses of the chatbot settings, the limit on lead forms and the limit on handoff requests (Pro). There is no setting for it yet.

Without the filter KimaAI ignores X-Forwarded-For, which any visitor can send, and takes the address the request came from. Behind a load balancer, a reverse proxy or a CDN that is the proxy’s address, so every visitor would share one daily limit. Return the proxies’ addresses or ranges: KimaAI then walks the header from the nearest hop and takes the first address that is not a trusted proxy.

Only IP addresses (IPv4 or IPv6) and ranges such as 10.0.0.0/8 count; anything else is ignored, and so is a range of every address (0.0.0.0/0, ::/0), which would trust the header from anyone. Trust only the proxies in front of your site.

Parameters

NameTypeDescription
proxiesstring[]IP addresses or CIDR ranges, none by default.

Returns

string[]: The trusted proxies.

Example

add_filter(
  'kimaai_trusted_proxies',
  function (array $proxies): array {
    // The load balancer in front of the site forwards the visitor's address.
    $proxies[] = '10.0.0.0/8';

    return $proxies;
  }
);
  • kimaai_chatbot_daily_message_limit: the limit the address is counted for.
  • kimaai_chatbot_gate: where KimaAI refuses banned IP addresses.

What are your feelings