Try running this code:
Route::get('/what-is-my-ip', function(){
dd(request()->headers->all());
});
And check if the client's IP is in one of the headers.
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_AWS_ELB;
@Ayman_Alshiekh well, you didn't answer if printing all headers has the user IP in some other proxied header.
It is also not clear if you provided any API keys for the geolocation services or the mastermind IP database to make the torann/geoip work properly.
So it is hard to help when you don't answer back any of the questions made.
If you want the user timezone, it is more reliable to send it from the browser and save it into the user's session. This is what I do on my projects.
A user can be traveling and have their preferred timezone set manually, or can be browsing through a proxy or VPN, so their IP location will be different than their real location.
You can get the client-side timezone with this JS code:
Intl.DateTimeFormat().resolvedOptions().timeZone
Please or to participate in this conversation.