So I had built a little URL shortener with Laravel 5.4 where I have a route that does: domain.com/{urlkey} - I grab the key and look it up in my Laravel cache which is in Redis. I also have another key that tracks the # of visits - so anytime the URL is accessed i Just increment the :visits key.
Now I have been noticing when i take one of these URLs copy and paste it into a new tab... or even click it from my application it just ignores my code completely. I can put in a die() and it wont even stop! which will never trigger the cache increment on the key...
Any ideas what is going on? Probably missing something very obvious.
The simple lookup and increment is below: but I dont even think it is hitting the code? Why would this be?
Other note the domain is https - however I have tested this on both http and https
// retrieve redirect URL from cache
$redirectUrl = Cache::get('short:' . $shortKey);
// if we find the redirect in the cache - increment visits - 301 redirect
if($redirectUrl)
{
Cache::increment('short:' . $shortKey . ':visits', 1);
return redirect($redirectUrl, 301);
}
via Citti