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.11k stars 372 forks source link

Some problems with caching #93

Closed pwnz22 closed 7 years ago

pwnz22 commented 7 years ago

Hello!

I have problems with caching.

I have to routes like so:

Route::get('/', 'Controller@method');
Route::get('{city}', 'Controller@mehtod')->name('city');

First route getting the location and redirecting to the second route: return redirect(route('city', [$city]), 301);

In the first routes method i have statement that checks cookie if it has a variable city and if not:

$city = geoip()->getLocation($request->ip());
return redirect(route('city', [$city]), 301);

Now when i'm entering the site browser immediately redirects me to the second route with the cached city. And what i need is that everytime the user requests '/' it must go to the first route and then to the second. But now it's not getting city from cookie if it's there.... okololo.ru - here is website.

In the config i have set'cache' => 'none'but with that also works the same(

sorry for my english :(

pwnz22 commented 7 years ago

Browser caching the 301 redirect, that was the issue.