Description
Right now, it can be difficult at times to understand why header_rewrite isn't behaving as you'd expect. There are a number of places where we can improve TSDebug().
Also, I'm going to do a code cleanup here, to make the code more inline with our current best practices (e.g. use if () { } consistently).