Drupal cron.php restriction

I recently made my first cron contrib module for Drupal, DB Maintenance. Since the DB Maintenance OPTIMIZE TABLE query locks the database tables it queries, I don't want just anyone to access cron.php anymore. The restriction I added was for the Apache .htaccess file that manages the clean URL rewrite rule.

<Files cron.php>  Order deny,allow  Allow from 207.7.108.211 127.0.0.1  Deny from all</Files>

207.7.108.211 is the current IP address of deekayen.net, which is needed instead of 127.0.0.1 when you run cron.php with lynx or wget as the documentation strongly suggests, which means 127.0.0.1 isn't the remote IP when Apache receives the request. I only put in 127.0.0.1 so in the future, if I need to access from localhost for some reason, I can.


Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Allowed HTML tags: <hr /> <a> <p> <em> <strong> <cite> <code> <blockquote> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
Your post will remain unpublished until David examines it himself to check for spam.