302 Redirect with cron.php On a rather old drupal site (D5) I get a 302 on calling cron.php when doing this via wget or curl. It worked fine for many years (via crontab). If I use a browser for that I get a 200 and a blank page (which is normal) the cron runner runs successfully. After trying to find a solution for a couple of hours it works fine with curl for no apparent reason, but not with wget and only if I run it directly (still 302 with crontab). As I type this I try again just to make sure and now neither wget nor curl work anymore, but running it through the browser still works just fine. Strange.

curl: curl -s http://www.mysite.com/cron.php
wget: wget -O - -q -t 1 http://www.mysite.com/cron.php


Any ideas?
302 redirect can happen due to Either server settings or manual redirect inside modules using functions like drupal_goto....

You need to debug to understand the problem.. Here are the steps to find out where it is going wrong...


To make sure it's not related to server settings go and comment below line in drupal_cron_run function inside includes/common.inc...

// module_invoke_all('cron')

If you cannot able to replicate 302 error then it's for sure some module which is implementing hook_cron is doing above redirect other wise check your .htaccess or server settings to debug more..
If you don't see 302 error go and uncomment above code you have commented to debug further...
Run below code in any page to understand which are modules implementing hook_cron.....

Code:

foreach (module_implements('cron') as $module) {
  drupal_set_message($module);
}

Verify all above modules which implements hook_cron doesn't have any redirect code.. Check custom modules in particular...
If nothing works.. Use Debugger like XDebug to debug step by step.