I think I copied this out of the PHP manual pretty much. So I tested the above code and everything worked, right? I wouldn't be writing this post if that was the case!

I tried the above in Firefox and Safari. My usual test plan is to make sure it works in those two browsers first, and then deal with IE. In this case it didn't work in either browser. I knew that some HTTP headers were off-limits in Flash, so just for just kicks I tried changing Koostom to Referrer. This should have caused an exception, but of course it didn't. It did nothing.

Finally, I found the answer through experimentation. You have to do an HTTP POST with form data in order to get the custom header sent:

6 comments:

It seems that if you pass more than about 2 custom headers (it might depend on the overall length but these are short strings), it doesn't send ANYTHING even on a POST. No error, no exception, nothing. And to make it worse - if you add a few more custom headers (maybe 4 or 5), it doesn't seem to even make the call at all, GET or POST! Again, no error indications, no exceptions. Just trash - I expect better from Flash and Adobe. They need to fix or at least explain this better.

Your solution is actually not a hack at all, here is what Adobe says on this matter, "Due to browser limitations, custom HTTP request headers are only supported for POST requests, not for GET requests."