So, in testing simplyXiangqi, I found I was getting error pages when I tried certain actions. The actions seemed to happen okay, but I got the standard Rail ‘Application Error’.
Looking in the logs, I was getting an error ‘malformed header from script’. ‘Curious’, I thought. The full error was of the form:
malformed header from script. Bad header=isRed = 1:
It seemed to me that part of my code was appearing as a header when the page was returned.
Eventually, I figured it out. My code still had ‘puts()’ calls in it. I’d added these for debugging during development on WebBrick. In WebBrick, the strings output by ‘puts()’ were written to the command window WebBrick was running under. On my Apache installation, though, this was output as a header. Consequently, I got errors.
I removed the ‘puts’ calls, and it all worked fine.
Comments from my old blog:
Thanks, buddy. Saved my sorry ass. 🙂