3 years ago

Get Real IP Address

Posted 3 years ago by 6ber6ou

Hi All.

I try to create a white list based on the IP address when the site is down for maintenance. I change the CheckForMaintenanceMode middleware like this :

public function handle( $request, Closure $next )

    $white_list = array_flatten( MaintenanceWhiteList::select( 'ip' )->get()->toArray() );

    if( App::isDownForMaintenance() )

        if( ! in_array( $request->ip(), $white_list ) )

            return response( 'Le site est en maintenance, revenez plus tard !', 503 );



    return $next( $request );


When I push my site to Forge (with Envoyer) the IP address retruned on my Mac and my tablette are the same !!

Who can I get the real IP address for every device ?

Please sign in or create an account to participate in this conversation.