Category Archives: Uncategorized

Get the right IP

Get the right IP

Was currently taking part in moving a WordPress site with a single webserver into a AWS Virtual Private cloud using an ELB to loadbalance multiple webservers.  Ran into an issue where IPs were not being grabbed properly and provided to the WordPress control panel for comment moderation.  I have already enabled the X-FORWARDED-FOR header in apache and wanted WordPress to capture this rather than the VPC IPs.

Placing the following in my wp-config.php made it possible to get the real IP via this header so we can better moderate without requiring registration.  It’s a hack, but it’s a useful one.

// ** bw 2012-08-12 wordpress reverse proxy x-forwarded-for ip fix ** //
  $xffaddrs = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
  $_SERVER['REMOTE_ADDR'] = $xffaddrs[0];
Tagged , ,

EC2 Instance Types – Quick link!

Here’s a great quick link to get all information on current AWS EC2 instance size and cost:

It’s come in handy lately when I need to compare against an existing physical system or create a system requiring specific vendor recommended memory/cpu resources.

Today I listened to Straight Ahead on my way to work this morning.  Listen to this: