Skip to content

Fix Forminator Proxy IP Check #225

Description

@spelkey-ucd

Forminator and the rt-forminator integration uses Forminator_Geo::get_user_ip() to get the user's IP. The plugin recently added a strict trusted proxy check, which is causing problems for IP detection on the main site, which uses a reverse proxy (router.library).

We need to register this proxy (169.237.102.131) through a filter:

add_filter( 'forminator_trusted_proxies', function( $proxies ) {
    $env_value = $_ENV['FORMINATOR_TRUSTED_PROXIES'] ?? '';

    if ( empty( $env_value ) ) {
        return $proxies;
    }

    foreach ( array_map( 'trim', explode( ',', $env_value ) ) as $entry ) {
        if ( $entry !== '' ) {
            $proxies[] = $entry;
        }
    }

    return $proxies;
} );

and then set an env variable with comma-separated ips: FORMINATOR_TRUSTED_PROXIES=169.237.102.131

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions