ZF3 Set trusted proxies for remoteAddr session validator

#1

Hi,
I have a ZF3 application running in MS Azure scale set hosting. I discovered a problem with sessions getting lost after 2-3 minutes which turned out to be the Azure application gateway. The application gateway uses a pool of proxy IPs which was causing my remote address session validation to fail. I can see the method setTrustedProxies() in the remoteAddr library class and imagine this is what I should use. I am specifying the remoteAddr validator in my session configuration within global.php am not sure how to set the proxies from here. Should I be looking at doing this in Module.php instead?

This is the relavent part of my global.php

    return [
    // Session configuration.
    'session_config' => [
        // Session cookie will expire in 1 hour.
        'cookie_lifetime' => 60 * 60 * 1,
        // Session data will be stored on server maximum for 30 days.
        'gc_maxlifetime' => 60 * 60 * 24 * 30,
        'cookie_secure' => true,
        'gc_probability' => 0,
        'cookie_httponly' => true,
    ],
    // Session manager configuration.
    'session_manager' => [
        // Session validators (used for security).
        'validators' => [
            RemoteAddr::class,
            HttpUserAgent::class,
        ],

    ],
    // Session storage configuration.
    'session_storage' => [
        'type' => SessionArrayStorage::class
    ],

I would be very grateful of any help with how to do this?

Many thanks,
Fergal