get user ip insteade of application load balancer ip laravel

Viewed 23

I run laravel application on AWS, I use Application Load Balancer.

Route::get('/what-is-my-ip', function(){ 
    return request()->ip();
});

When I run this code, my ip doesn't show, it shows the load balancer's ip addresses.

My TrustProxies Middleware

protected $proxies = '*';

protected $headers =
    Request::HEADER_X_FORWARDED_FOR |
    Request::HEADER_X_FORWARDED_HOST |
    Request::HEADER_X_FORWARDED_PORT |
    Request::HEADER_X_FORWARDED_PROTO |
    Request::HEADER_X_FORWARDED_AWS_ELB;
0 Answers
Related