Tag: Apache

Let the Facebook Object Debugger Into Staging

October 27, 2012 » Geek

One often important, and often overlooked aspect of modern web development is Open Graph tags. You know, those meta tags with weird attributes that break your page validation? That’s a whole other topic though.

Today, I want to talk about the Facebook Object Debugger, and giving it access to an HTTP Auth protected environment, such as a staging or pre-launch production site. This is Apache specific, so nginx fans will have to look elsewhere.

Assume you have this setup in your Apache config or htaccess;

The easiest way that I’ve found to make this work is to accept based on user agent. I originally tried allowing it based on IP address, but the debugger uses many IP addresses, and after I had added a half dozen I gave up and switched to user agent.

Be aware, that because of this, it’s quite easy for someone to fake their UA and gain access, so I recommend only using this code while you actively use the debugger, and turning it off afterwards. This also prevents leaks if someone pastes the URL into an actual Facebook comment.

Pretty easy!

Check out this page at AskApache for a nice guide to SetEnvIfNoCase.

Finding 500 Errors On DreamHost

August 16, 2010 » Consume, Geek

Recently I’ve been getting 500 errors once in a while on my DH account. This is usually because a process is long running and the DH monitor kills it for consuming too many resources. Meh. The real cause is putting waaay to much stuff on a shared account.

So, to see what my culripts are I wrote a quick script that I’m hooking to a cron job. First I’ll see what domains are generating 500 errors, and then later I’ll try to locate the exact scripts and clean them up.

500-Error-Finder.sh

The output looks like this.