Reputation: 361
I am developing an web app with Laravel and I encountered this "strange" behavior. Some controller actions are called twice. I know so because on my logs I see (for one page refresh) two full sets of entries. My controller action starts like this:
public function action_edit($rid=-1) {
// Calc Input
$id = Input::get('id', $rid);
Log::TWICE("?? {$id} - {$rid}");
where $rid is the object id to edit as requested by the url, however if I get an id in my Input, then I use this id instead. So when I call my controller via a url like:
.../mycontroller/edit/1
I get TWO entries in my log file:
2013-02-07 00:49:15 TWICE - ?? 1 - 1
2013-02-07 00:49:16 TWICE - ?? img - img
The first one is the normal that I should see, however the second one I don't understand where it is coming from. I checked using the Chrome's developer tools (both network tab and console tab) but there is no sign of the second request!! I initially thought that I might try to use some resource with a relative url of img or ../img but I found no clue. Of course img is the name of my images folder on my template but there is nowhere in my code a relative url img by itself...
Do you have any suggestions regarding this issue? Where else in my code should I examine/check? What else could trigger the second call?
NOTE: I am using the following call at some point on my code but the referenced action is 'show' not 'edit'!!
Laravel\Routing\Controller::call($controller.'@show', ...
Thank you in advance!
Pan
Upvotes: 2
Views: 3081
Reputation: 5030
This is an old question, but I still see this at the top of the Google result when I search for solution, so I decided to add this answer after I finally find the problem.
The current answer that marked as correct is only partially correct: it is related to image, but it is not limited to Favicon.
Somehow all major browser (at least for IE, Firefox and Chrome) decide that when there is an empty link provided to whatever place that is supposed to be an image, they will make it the current URL. Some example of places that may cause problem:
<img src="">
<div class="background-image:url()"></div>
<link rel="icon" type="image/x-icon" href="">
Provide a link or simply remove the line will solve the problem.
Upvotes: 0
Reputation: 501
I had a similar problem, and the cause was a Trend Micro Firewall we were behind.
The datacenter was crawling every URL submitted, causing it to be hit twice.
This post has more information
I spoke to our web admin who said he would exclude the site from TrendMicros link site check
Upvotes: 0