Over the holidays I spent sometime perusing the log files on my server and found several interesting problems. One of those interesting issues dealt with the traditional cron job I had setup running wp-cron.php every 15 minutes on this blog. It seems I neglected to adapt the cron job when I enabled both SSL and SNI on this website. I previously had the following running in cron every 15 minutes;
*/15 * * * * wget http://blog.michaelfmcnamara.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
There are a few issues with this… wget was not following the redirect from HTTP to HTTPS after I forced HTTPS/SSL as the default for all traffic. And since I was using multiple virtual hosts behind a single IP address I was relying on SNI and the HTML headers to determine which virtual host the request should be delivered to.
Here’s what I’m running today in my cron;
*/15 * * * * curl --header 'Host: blog.michaelfmcnamara.com' https://blog.michaelfmcnamara.com/wp-cron.php?doing_wp_cron=true > /dev/null 2>&1
If you are forcing all traffic to SSL you might want to check any old links you have lying around and if you are using SNI you’ll definitely need to attach the proper host headers to the HTTP request.
Cheers!