Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug an issue happening only when a (google) bot requests a page?

My application is throwing a Zend_Locale_Exception when called from googlebot where ZF sends the following error message:

Autodetection of Locale has been failed!

The problem is probably because the default locale isn't set, but how can I debug this?

Since google bot isn't real time I need to actually forge the HTTP Request the bot is making, but how can I find out how this request is being made?

Trying to send the Accept-Language header with curl wouldn't reproduce the error:

   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, 'http://www.mysite.com.br/');
   curl_setopt($ch, CURLOPT_HEADER, true);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Language'));
   echo $data = curl_exec($ch);
   curl_close($ch);

EDIT:

to clarify even further:

  • I Know the issue is probably the lack of a default locale, but I NEED to debug this
  • Changing the user agent of my browser doesn't work, it only changes the UA string, the Locale is still sent from my browser
like image 352
Jonathan DS Avatar asked Nov 20 '25 03:11

Jonathan DS


1 Answers

There is a "Fetch as Googlebot" feature in Google Webmaster Tools. You might be able to use this to trigger the bot hitting your site. You could even temporarily add a phpinfo() page to your site and use the feature to hit that, which will list all the headers in the response that it shows you.

like image 66
Tim Fountain Avatar answered Nov 21 '25 16:11

Tim Fountain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!