I’m writing a new import module for our real estate system where I have to read several XML files and process many photos, resizing them for the web and updating the database. Due to the amount of picture files to process, I was getting CF tag timeouts, sometimes the image tag, sometimes other tags. So instead of doing everything in one processs looping through all XML files, I decided to pick the first one up and process it, and at the end I put a CFLOCATION to call itself to process the next file until there are no file to process.
The template worked well, did everything it had to do, but stopped at the end without calling itself to process the next file, and did not throw any error.
It took me a long time troubleshooting it, then I found an article by Peter Freitag about the tag CFLOCATION performing a client redirection where he mentioned another option of using CFHEADER to redirect:
<cfheader statuscode="301" statustext="Moved Permanently">
<cfheader name="Location" value="http://www.website.com/">
That didn’t work either, but at least threw an error saying something about the page had been flushed.
Well, looking at my code I could see the several <cfflush> tags I had to track the process in real time. As soon as I took them out of the code, the template worked perfectly.
So I wrote this post just to admit my stupidity and to alert our colleagues not to use the combination CFFLUSH and CFLOCATION.