Small optimization suggestion:
```
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) || !empty($_SERVER['HTTP_X_REAL_IP'])) {
    $proxy_whitelist = rcube::get_instance()->config->get('proxy_whitelist', array());
    if (in_array($_SERVER['REMOTE_ADDR'], $proxy_whitelist)) {
        // do the magic here
    }
}
```

1. Don't use global $RCMAIL (I know this is also used in method `https_check()` but should be fixed there, too).
2. Check for HTTP_X_* headers first before loading config option (costly operation with plugin hook calls, etc.)
3. Define `array()` as fallback for the config option in case the defaults are not updated.