nginx header inconsistency, aka setting headers all the way down

For the three visitors I attract in a month, I’ve had an outsized interest in making this the most secure WordPress site that I can. My focus of late has been primarily on the security-related headers I can set. In particular, ensuring that HSTS and HPKP were present on all requests became a priority.

Why?

A few weeks ago, I noticed that certain assets served from my CDN host lacked the Strict Transport Security headers (HSTS) I’d expected. To the best of my knowledge, I’d configured nginx to set these headers on every request.

Continue reading nginx header inconsistency, aka setting headers all the way down

Building My Network

Over the past three years, I’ve spent more time than I care to admit on a single project. It started off innocently. Since then it’s grown to occupy a significant place in my daily thoughts.

As you read this, you’re experiencing the product of these efforts. Perhaps you clicked on an eth.pw short URL to get here. If not, your browser still had to figure out how to get to ethitter.com. Now that you’re here, maybe you need to contact me via email. To make any of these endeavors possible, I’ve built a personal “network” of servers and had endless fun doing so.
Continue reading Building My Network

Hello PHP 7!

With relatively little difficulty, I’m now running PHP 7 alongside PHP 5.6. PHP 7 was released at the beginning of the month, and WordPress was one of the platforms tested against. Given that I can’t stop tinkering with this server’s configuration, I really had no excuse not to set up PHP 7.

Given the myriad services I’m running, I couldn’t switch to PHP 7 outright. While WordPress and YOURLS (powering my url shortener, eth.pw) both support PHP 7, the compatibility list basically ended there.

As I went into this with a fair bit of trepidation (and many backups), what follows is a bit about my experience.

Continue reading Hello PHP 7!

Following sports as a nomad

One early struggle with not having a television came when trying to watch a baseball or hockey game. For starters, Airbnb rarely feature TVs that receive useful channels, nor do hotels.

I solved most of the problem with an Apple TV and subscriptions to MLB.tv and NHL Center Ice, save nationally-broadcast and playoff games. This was particularly vexing during last year’s MLB playoffs while I was in San Francisco.

Thankfully, there exist services such as Adfreetime and Unblock.us, like VPNs, that circumvent geolocation restrictions. Their advantage is that rather than routing both the location check and video stream through their servers as a VPN does, only the geolocation request is intercepted. The result is a smoother streaming experience.

Remembering Where I’ve Been

As I wrote about yesterday, colleagues struggled to track my whereabouts, so I created https://whereis.ethitter.com/ for real-time updates.

I’ve since discovered that my coworkers aren’t the only ones who can’t track my movements–I found myself struggling to remember where I’d been at a certain points as well. Borrowing the idea from Philip Arthur Moore, I created a WordPress plugin that uses a custom post type to record my travel history. The end result is at https://ethitter.com/timeline/.

I haven’t released the plugin yet, but if there’s interest, I’ll clean it up and post it to GitHub.

Tracking A Nomad’s Whereabouts

One of the unique challenges I encounter as a nomad who also leads a team is accessibility, both to my team and my coworkers in general. While I can predict when my team will be working based on their locations, they cannot do the same for me.

Following a rather entertaining conversation in which I asked a coworker about the weather where he lives and he couldn’t respond in kind, I created https://whereis.ethitter.com/. Currently it’s just a series of scheduled posts, but I would eventually like to tie it either to TripIt or Foursquare. As it happens, I’m running Beau Leben’s excellent Keyring Social Importers, so I already have data from those services accessible within the multisite installation that runs all of my sites.

Are there other, non-homegrown, solutions to accomplish the same? I’ve found a few, but all try to do too much for my needs. One of these days, I suppose I’ll get around to leveraging the data I already have so I can automate this process.

If you travel frequently, have you encountered the same problem? How did you address it?

Redis Object Cache for WordPress, the Accidental Effect of PHP 5.5

Last week, I went a little upgrade-crazy with the VPS that hosts this site. With SPDY 3.1 support in nginx 1.5, I upgraded. I also bumped PHP from 5.4 to 5.5.

The latter change is significant because PHP 5.5 drops support for APC, and I was using APC for both opcode caching at the PHP level and object caching at the WordPress level (thanks to Jaquith’s plugin). Since I’d lost my object cache, I’d also lost my page cache because I was using Batcache. Nice job, Erick.

Almost a year ago, I contributed two small changes to Eric Mann’s WordPress Redis Backend plugin. With Redis already running on my VPS for reasons unrelated to WordPress, it seemed an obvious choice over competing persistent caching options.

I spent some time updating Eric’s plugin (see https://github.com/ethitter/wordpress-redis-backend/commits/master for the fun I’ve had) and sent a massive pull request back with my changes. I’ve been using the plugin for a few days now without incident, though I wouldn’t rush to switch over just yet unless you’re adventurous. I’d watch Eric’s repo if you’re interested in what comes of my efforts.

Automatically Add New Users to a BuddyPress Group

Ever wished you could automatically add newly-registered users to a specific BuddyPress Group? I’ve had a number of clients make this request, and it turns out to be easier than I’d initially expected. Simply paste the following code into your theme’s functions.php file, replace <# group ID #> on line five with the numeric ID of the desired group, and any users who join after that will automatically become members of the group. I’ve tested this snippet with BuddyPress 1.2.x.

//Automatically add new users to a group
function automatic_group_membership( $user_id ) {
 if( !$user_id ) return false;

 groups_accept_invite( $user_id, <# group ID #> );
}
add_action( 'bp_core_activated_user', 'automatic_group_membership' );