Torann / laravel-geoip

Determine the geographical location of website visitors based on their IP addresses.
http://lyften.com/projects/laravel-geoip
BSD 2-Clause "Simplified" License
2.09k stars 372 forks source link

Always returning default Laravel 5.8 #137

Open MrEhsanEllahi opened 5 years ago

MrEhsanEllahi commented 5 years ago

I am using this package in laravel 5.8 project. I am using default geoip api. But it always returns the default value. Any solution, Code is below.

namespace App\Http\Controllers;

use Illuminate\Http\Request; use \Torann\GeoIP\GeoIP;

class HomeController extends Controller { // public function index(){ $ip = geoip()->getClientIP(); $arr_ip = geoip()->getLocation($ip); return view('index')->with('arr_ip', $arr_ip); } }

norellanac commented 5 years ago

i'm tryin in laravel 5.8 in Guatemala, and always return default, but if pass an IP from amazon server return the ip info

arbiyanto commented 5 years ago

Check your logfile in storage/logs/geoip.log. At first I thought it was a bug, apparently I detected the wrong IP address (I detected my own local ip address), then Geoip will return default/fallback data because the error on ip address.

JexPY commented 4 years ago

@naorellana Mostly when you are working on AWS servers and want to receive real user's ip you should check X-Forwarded-For or restrict all users and allow them to use your page if they have REMOTE_ADDR in header. Also if you are using Laravel 6.0 and above they have added TrustedProxy in the main package so you should just 'proxies' => '**' in trustedproxy.php