wordpress 3.5.1, a broken add media button, and mod-pagespeed

I ran into a strange problem after upgrading to wordpress 3.5.1.  I’ve read that this problem can affect some hosted wordpress instances as well (though not wordpress.com).  Most of the other posts in wordpress support forums point to a plugin or theme that has some broken javascript.  After disabling all of my plugins and reverting to the default wordpress theme, my issue persisted.  I wasn’t able to get the javascript media upload to work.  My “add media” button and “Set featured image” links didn’t work on any of my pages.

I finally came across a post in the wordpess forums that pointed to mod_pagespeed as the culprint.  The .js files in /wp-admin/ are already minified, and mod_pagespeed attempts to compress them again.  As a result, the javascript doesn’t work.

The quick solution?  Add the following to your .htaccess file in the /wp-admin/ directory:

ModPagespeedDisallow *

This will keep mod_pagespeed from compressing anything in your /wp-admin/ directory, and your javascript now works.  If your web host allows .htaccess directives, this should also work for hosted wordpress instances.

.htaccess rules behind load balancers and proxies

I have several apache servers that sit behind various load balancing appliances and assorted reverse proxy servers.  I don’t maintain the proxies and from time to time I have the need to allow/block IPs and ranges of IPs from my web servers.

Normally my .htaccess files contain something like this:

Order deny,allow
Deny from all
Allow from 192.168.1.0/24
Allow from 10.0.6.0/24

If you’ve got a reverse proxy in front of your web server, all of the traffic appears to originate from the proxy instead of the true origin.  You can use the apache’s mod_setenvif to extract the original IP address (the X-Forwarded-For value) and then use some regex to update your allow/deny rules.  Your rules then look like this:

Order deny,allow
Deny from all
SetEnvIF X-Forwarded-For "^192\.168\.1\.([1-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-4]))$" AllowThisSubnet
SetEnvIF X-Forwarded-For "^10\.0\.6\.([1-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-4]))$" AllowThisSubnet
Allow from env=AllowThisSubnet

If you’re like me and not a regex master, Google analytics (and I’m sure other places) has this helpful calculator to generate the regular expressions that you need on your SetEnvIF lines.

Ubuntu 12.04, Ivybridge, and Intel HD4000 graphics on the HP Z220 workstation

I enjoy hacking on old hardware and making linux run on things that weren’t designed to run it.  It’s not a very productive way to use time at home, but I end up learning a lot about the inner working linux.  It’s how I taught myself to use linux in the mid 90′s.  It’s great fun (!?) and you’ll learn how linux works.

I also highly discourage doing this at work and on any production level machines in your life.  Use the -stable branch.  Use the LTS version. Life is much easier when you follow that path.  You’ll also be much more productive because you’re spending less time compiling modules and more time writing code that contributes to the bottom line of your business.

Occasionally, these two path cross.  I normally don’t have bleeding edge workstations to deal with, but this month I did.  The HP Z220 is a fabulous piece of hardware.  Xeon processors and solid state drives are amazing.  The problem is that the built in Intel HD4000 graphics adapter will only mirror the display to the HP display port with the xorg modules that are currently in Ubuntu 12.04. I didn’t want to upgrade to 12.10, so the next best solution was to update the kernel.  I have tested this process only with a 3.6.x kernel.  I’ve read that 3.4.x might work, but I have failed to get it to work with a 3.2.x kernel.  Kernel 3.6.0 is available from Quantal mainline, and here’s a guide to install the it in 12.04 if you need such a thing.  That’s still doesn’t fix the display port issue.  You still wont’ be able to extend the display, but kernel 3.6.0 will correctly identify the chipset as Ivybridge.

You’ll now need a PPA with updated intel and mesa packages.  I’m using Oibaf’s repo which you can add by executing:

sudo apt-add-repository ppa:oibaf/graphics-drivers
sudo apt-get update
sudo apt-get upgrade

Reboot and go to display settings and you should now be able to uncheck the ‘Mirror Displays’ option and extend your desktop to a second display device.

Top 5 Reasons to be at Ohio LinuxFest 2012

Ohio LinuxFest is September 28th and 29th.  If you’re even remotely interested in Linux/FreeBSD and anywhere near Ohio, you should get to Columbus for it.  Here’s why:

5. It’s free as in speech and (can be) free as in beer.  Gratis and libre.   If you’ve got some cash, pick up a pro registration.  If you don’t, show up on Saturday anyway and learn something about the free software movement.

4. Dru Lavigne will be there.  Dru is the reason I got started with FreeBSD in the early 2000′s.  Her documentation caused me to favor FreeBSD over Linux for servers for a long time.

3. Hear about Stopping SOPA and its Spawn: Free Expression on the Internet. The free (libre) and open internet is in serious jeopardy.  Governments and corporations are looking to lock down, spy on, and regulate internet usage.  Come learn how to do your part to keep the internet open.

2. MC Frontalot will be playing the after party on Saturday.

1. John “maddog” Hall will be there.  Google him.  He’ll make you realize that free software is better than closed source. His keynotes are seriously inspirational.

This will be my third year at Ohio LinuxFest, and it’s been worth every trip.  Get there if you can. It will be worth it.

Ohio LinuxFest 2011

 

Once every year I make the short drive to Columbus, Ohio for the Ohio LinuxFest. It’s taken for granted that Jon “maddog” Hall will be delivering some sort of keynote, and that alone makes it worth the time. If you have never had the opportunity to hear maddog talk about the past, present, and future of open software you’re doing yourself a disservice.

LinuxFest is not the greatest conference that you’ll ever go to. Most of the presentations are good, but if you’re involved in open source at all, you have most likely heard of pretty much everything that will be presented. You’re going to see a presentation or two that open your eyes to a new project that somehow escaped your radar, but usually nothing so off the charts that you’ll be forever changed. Mine this year was the HTSQL presentation by Catherine Devlin. I’ve been evaluating a proprietary package for a few months that does pretty much exactly what HTSQL can do, and it never came across any of my google searches. I’m not sure how that happened, but the presentation was solid and I’m now looking into a new free software project.

The most entertaining presentation of the Fest goes to Don Vosburg. I’m not sure he knows it, but he’s got an awesome sense of humor. While I knew about (and use) SUSEStudio, the presentation was still informative and had a fantastic delivery.

Now, back to maddog. What is there to say? Listening to his vision for open source software is like hooking your batteries up to a power station. After listening to maddog, you will leave believing that the open source movement works. It does work, but sometimes slogging along and working to make inroads into organizations that are open source averse is a tough road. Maddog makes you remember why you’re an open source evangelist. He makes you remember why you first started playing with Linux back in 1998. You get excited again, and you go back to your job and push on for another year.

If you work in a place that doesn’t “get” free software yet, you have to listen to maddog. Find a recording where he talks about the future of free software. It’s truly inspiring stuff. His current work on the caua project isn’t just about free software, but a real vision for how free and open source software will change the world.

Ohio LinuxFest 2012 is only 364 days away. Start planning today and make a point of going.