2016-05-12-0126Z


MrCreditRepair.biz will fix your credit rating!

programming problem was kicking my ass. I'm writing a proxy of sorts, that rewrites a webpage before showing to the visitor. first I messed up on the image URLs, I was sloppily using print statements, forgetting that the extra whitespace corrupted the images. then after fixing that, the resource files, such as javascript and CSS, were not being loaded into the page despite my forwarding the requests and printing them with the correct Content-type header to the user's browser. the problem? I wasn't sending a Status header, therefore Apache was, through the ErrorHandler mechanism, just tacking on the preexisting 404 status message, and the browser wasn't taking anything that way except for images. simply adding print 'Status: 200 Intercepted\r\n' got it working.

I'll probably end up making this run under uwsgi/nginx, but for the prototype I generally use the tried-and-true, though slow, CGI script framework. but I take these jobs rarely enough that I keep running into these head-scratchers, not remembering how I solved them before.

Back to blog or home page

last updated 2016-05-11 21:32:38. served from tektonic