2009-02-03

Rewriting URLs on the Citrix Netscaler

So today I had the task of setting up a failover configuration for our email deployment server, affectionately known as "Strongbad".

We created a VM to function as the failover server, but in order to get things to work we needed to modify the URL to capture the entire path and pass it as a value to a PHP script. For instance, the URL the user would click on would look like:

http://strongbad.company.com/track?type=click&mailingid=42&messageid=42&databaseid=test&serial=20090203&emailid=sb@strongbad.com&userid=1&extra=&&&2004&&&http://tracking.company.com/account/listings/?emailUserId=42

If the Strongbad box were to become unavailable, we want the VM to step in. There is a script called strongbad_redirect.php and to simplify things we're just passing the original path directly to this script. The script takes care of parsing out the data and redirecting the user to the appropriate page.

The pertinent lines in the Netscaler are:

add rewrite action act_sbad_req_rewrite insert_before HTTP.REQ.URL.PATH.GET(1) "\"strongbad_redirect.php?\""



add rewrite policy pol_sbad_rewrite "HTTP.REQ.HOSTNAME.SERVER.EQ(\"strongbad.company.com\")" act_sbad_req_rewrite



bind lb vserver mail1 -policyName pol_sbad_rewrite -priority 100 -gotoPriorityExpression END -type REQUEST
Slice and Dice with awk

Just learned a new way to slice and dice a text file. So say you have a file that's 1 million lines long, but you only want to see lines 234567 to 300000. You can use awk to only print out those lines.

awk '{ if (NR >234567 && NR<300000) { print $0; }}' bigfile.txt > bigfile-sliced.txt


2008-05-09

Why you shouldn't overclock your GPU


This is an actual picture of a Dell PowerEdge (1850 I think) from my last job. I received a call early in the morning from one of the data center engineers letting me know that they had to pull the power plug because smoke was coming out of the case. Oops.

2008-05-07

Poor Pug

I'm not sure why I find this so hilarious but...I do.



Check out more of these at Fail Dogs.

2008-04-15

Google Maps API and Trulia



My company's 3 minutes of fame (and I'm in it for a whole 2 seconds - w00t!)