Flash: Nasty XML load bug in Internet Explorer
November 17th, 2005 by ThomasLoading XML files in Flash over an SSL Connection in Internet Explorer fails if the Pragma:no-cache or Cache-control:no-cache HTTP headers are set on the XML file.
Wow! I’ve been chewing on this one for a while… We have a Flash site running on https with dynamically generated XML content. The server always returned the Pragma:no-cache header so that the dynamic data isn’t cached in the browser.
The bug is especially hard to find because the request goes out to the server successfully, but the XML object in flash remains undefined for no apparent reason. Only after removing the header output on the server it started to work.
Not nice.
This MS bug report seems to be related.
[edit]
This post has been replaced by a more recent one, including an application to test the caching behavior of Flash in different browsers.
Flash loading and browser cache test-suite
[edit]
Some more posts on the topic:



November 18th, 2005 at 5:07 am
IE + HTTPS + XML + NoCache = Bad
…
December 2nd, 2005 at 7:37 am
Can you please explain how you did this. I am having a similar issue with my flash file on https it isn’t pulling in my xml file in IE, but works fine in firefox. Please let me know what I need to do to fix this. I don’t have any headers set in my xml file.
January 24th, 2006 at 5:58 pm
This bug also affects the MovieClipLoader.loadClip() function as well as XML loading.
I discovered this when I tried to load a dynamically generated JPG from a PHP page over HTTPS. With the header “Cache-Control: no-cache” set, nothing would appear in IE but would work fine in Mozilla/FireFox.
Hope this helps someone.
February 16th, 2006 at 5:45 pm
Thank you very much for your solution thomas!
March 15th, 2006 at 7:56 pm
Hey - I had this problem and it stumped me for about 3 hours. I’m generating XML dynamicly with PHP. I messed around with trying to set header(”cache-control: private”) for a while and had no luck. Finaly I tried and that did the trick. Use it at the very top of the page for best results. I hope that can save somebody else some headaches.
March 15th, 2006 at 7:58 pm
whoops, it killed my code there it should be - Finaly I tried “sessioncachelimiter(’privatenoexpire’);” and that did the trick.
March 24th, 2006 at 11:34 pm
OK one last time… the markdown is messing up my code. There should be underscores around “cache” and “no” - so “session UNDERSCORE cache UNDERSCORE limiter(’private UNDERSCORE no UNDERSCORE expire’);â€
Wow - I’m sure there’s a simpler way to do that :)
April 13th, 2006 at 1:48 am
Hi. I have one problem with xml & flash. I use xml to display only text in flash file. But when i put this files on my ftp server and second time when i make some changes on that text in xml, my browsvers: IE, Mozila and Opera read my old xml file from cache. No from ftp server. Please for help.
April 13th, 2006 at 2:40 pm
Kosta, you seem to have a simple caching effect, a common browser behaviour. There are strategies to prevent caching of static files, like this one.
May 9th, 2006 at 9:21 am
Thank you Thomas, it really helped me to save dozen hours of headache. “Chche-Control: private†have changed the header using server side script (PHP in my case), which solved the Flash issue loading XML over SSL. We may alter the global header parameters of Apache, though individual settings per file seems to be a better, unaffecting the rest of applications.
Kaveendra (kaveendrav@sltnet.lk)
June 12th, 2006 at 8:31 pm
[…] one uninformed. Loading XML over SLL in IE could cause Flash to fail in parsing the data. Click here for the full description Quickly bookmark Flash: Nasty XML load bug in Int […]
June 15th, 2006 at 5:03 am
Thanks you all, indeed.
I was loading into Flash an XML file generated dinamically with php, from same domain, same directory, not using SLL nor HTTPS… Since the release of IE ActiveX Content Protection the PHP intruction: header (”Cache-Control: no-cache”); made that Flash failed to open de XML file. There was no problem with Firefox. I just deleted the php cache instruction and it started to work fine, again.
Cheers, from Argentina.
July 11th, 2006 at 1:48 am
In PHP i ended up using these headers:
header(”Cache-Control: cache, must-revalidate”);
header(”Pragma: public”);
Worked a treat!
Not sure what that means to the SSL stuff tho…
September 19th, 2006 at 3:34 am
I had a similar problem and had a look at the difference between the headers sent for a static xml file (from Apache) and the ones from a dynamically generated one (Apache + PHP5.1.3). Here they are:
PHP Generated XML Headers:
HTTP/1.x 200 OK
Date: Tue, 19 Sep 2006 00:43:38 GMT
Server: Apache/2.0.55 (Win32) PHP/5.1.3
X-Powered-By: PHP/5.1.3
Cache-Control: cache, must-revalidate
Pragma: public
Content-Length: 1143
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: text/xml
Static XML File Headers:
HTTP/1.x 200 OK
Date: Tue, 19 Sep 2006 00:44:41 GMT
Server: Apache/2.0.55 (Win32) PHP/5.1.3
Last-Modified: Tue, 19 Sep 2006 00:42:56 GMT
Etag: “a6e0-477-c583a8fb”
Accept-Ranges: bytes
Content-Length: 1143
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: application/xml
I used the following in PHP to make the headers equivilent to a static file:
sessioncachelimiter(”nocache”); // removes cache-control header
header(”Accept-Ranges: bytes”);
header(”Content-type: application/xml”);
Seems to work fine now! Thanks!
October 3rd, 2006 at 11:32 am
Woohoo! Thank you so much for this! Have been pulling my hair out over the exact same probelm. You’re my hero……..
October 27th, 2006 at 9:02 pm
[…] lessrain blog » Blog Archive » Flash: Nasty XML load bug in Internet Explorer lessrain blog » Blog Archive » Flash: Nasty XML load bug in Internet Explorer Stupid fjax. Good freaking […]
January 29th, 2007 at 12:13 am
[…] e: text/html I have spent lots of time to solve this stupid bug. Luckily, I found this post. In short, I had to send this header: header(’Cache-Control: cache, must-revalidate’); hea […]
March 12th, 2007 at 8:14 pm
Had the same issue (in IE 6) with a provider sending flash with HTTP/1.1 Cache-control set purely to no-cache. The flash file is sent to client, but not loaded. After some tracing and tweaking, with fiddler and the like, i managed to reproduce the case on my local Apache and trace the problem to cache-control.
When i do NOT want to cahce i always send (Overkill? Might, but after working/testing behaviour with different browsers: nope):
HTTP/1.1 header;
Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0
and HTTP/1.0 header;
Pragma: no-cache
and Expire and Last-Modified propperly formatted with GMT.
For some reason i do not have the time to dig trough now, sending only “Cache-Control: no-cache” as the provider do, causes this behaviour in IE, while applying no-store fixes the problem.
rfc2616:
14.9 Cache-Control ++
March 14th, 2007 at 12:48 pm
Can you please explain how you did this. I am having a similar issue with my flash file on https it isn’t pulling in my xml file in IE, but works fine in firefox. Please let me know what I need to do to fix this. I don’t have any headers set in my xml file.
March 21st, 2007 at 9:13 pm
I’m using Flex (flash) + SSL + XML + PHP + Sessions and I was having the same issue with internet explorer.
I was able to resolve the issue with this a the beginning of the php script:
sessioncachelimiter(’must-revalidate’);
so finally ie6 and ie7 works.
March 21st, 2007 at 9:46 pm
After some testing the “sessioncachelimiter” in php was causing the xml file to be cached indefinitely.
If you are using php and sessions, you must place the cache control headers after “session_start()” in order to work.
March 24th, 2007 at 11:43 am
Thanks you all, indeed.
I was loading into Flash an XML file generated dinamically with php, from same domain, same directory, not using SLL nor HTTPS… Since the release of IE ActiveX Content Protection the PHP intruction: header (”Cache-Control: no-cache”); made that Flash failed to open de XML file. There was no problem with Firefox. I just deleted the php cache instruction and it started to work fine, again.
Cheers, from Argentina.
March 27th, 2007 at 4:50 pm
Hi, Thanks for the tricks.
There’s another problem, i’m gonna explain it.
Working with flash + php + ssh
what i should do to keep the session alive? I have lots of pages that work with flash grabbing data with php and if i put sessioncachelimiter(”must-revalidate”) i can’t, obviusly, keep the session on other pages. The result is that the login works fine but when i try to load data with sendAndLoad actionscript command the php page called in the url has no session… and with sessionstart() u know what will happen. I’ve also try with sessioncache_limiter(”privatenoexpire”) but no good news.
Anyone has a tip for it?
Thank you!
March 27th, 2007 at 5:04 pm
UPDATE: i’ve found it! :D
Use: sessioncachelimiter(”none”);
Best Regards!
April 1st, 2007 at 2:13 am
Hi,
I had a similar problem to what’s been discussed here, except that it didn’t involve XML — but one of the solutions ended up solving it, so I wanted to provide the details for anyone else who might google their way here. :)
I have a secure Flash form that uses loadVars to communicate with php. There’s a PHP session involved, and sure enough, in Internet Explorer 6, under https, all my loadVars calls would fail immediately.
This bug was solved, finally, by trying out all the suggestions posted by everyone else here. In fact, most of them didn’t work, but one (thank God!) did.
MY SOLUTION (tested in IE, FF, MZ and OP):
Immediately after session_start (), the following two lines are required:
header (”Cache-Control: cache, must-revalidate”);
header (”Pragma: public”);
Please note that, in my case, trying to specify anything for session _ cache _ limiter had no effect (I tried “none”, “nocache”, and “private _ no _ expire” as suggested above).
Anyway, I hope that this information proves useful to someone. I can’t tell you how thankful I am that the rest of you discussed this, as it has seriously saved my bacon!
April 11th, 2007 at 7:25 pm
I did some testing and found out that the problem is not the header tags but the session_start() itself;
I did some research on PHP. net and found something that helped me out
header(”Cache-Control: no-cache, must-revalidate”);
header(”Expires: Mon, 26 Jul 1997 05:00:00 GMT”);
sessioncachelimiter(’public’);
session_start();
April 11th, 2007 at 7:26 pm
sessioncachelimiter(’public’);
is session “underscore” cache “underscore” limiter
April 11th, 2007 at 8:13 pm
Ok one more addition
header(”Cache-Control: no-cache, must-revalidate”);
header(”Expires: Mon, 26 Jul 1997 05:00:00 GMT”);
if(strstr(strtolower($SERVER[’HTTPUSERAGENT’]),”msie”) !== false){
sessioncachelimiter(’public’);
}
sessionstart();
April 11th, 2007 at 11:03 pm
canuckster u r a genious. tried everything from but your lines does the trick. TNX!!!
I’m repeating the lines for your convenience…
header(”Cache-Control: no-cache, must-revalidate”);
header(”Expires: Mon, 26 Jul 1997 05:00:00 GMT”);
sessioncachelimiter(’public’);
session_start();
April 13th, 2007 at 1:22 am
Glad to be of service, UV40. I certainly know what a relief it was for you, ’cause that’s what it was for me!
BTW I referred this method to a dedicated PHP developer to ask if he had any concerns about the solution, and he gave it his OK.
April 20th, 2007 at 8:25 pm
Ruby on Rails fix that works… THANK YOU SO MUCH EVERYONE! 2 days with this one… brain… tired… flash… xml… blerg…
April 24th, 2007 at 5:28 pm
Thanks a lot guys!
this was really helpful!
What a mess to have a Flash based Web-shop running (of course) over a SSL and using PHP sessions… my god!
=)
May 30th, 2007 at 2:40 am
I am having the same problem, nothing seems to work. When I visit the XML file via FF, I see the correct information. When I visit a portion of my website that uses PHP XML with flash, it does not load correctly. I tried every suggestion on here, and nothing seems to work. I even have tried
Nothing seems to work. Any suggestions would be appreciated.
June 1st, 2007 at 7:26 pm
dazed, try with these headers:
header(’Content-Type: application/xhtml+xml’);
header(’Pragma: no-cache’);
header(’Cache-Control: no-cache, must-revalidate’);
They are working for me on ie 6 and firefox 2 (firefox didn’t have a problem, it was just ie as described by Thomas).
June 2nd, 2007 at 12:25 pm
I am having a similar problem, however it involves loading swf files into another swf both on the same domain running on https. In firefox it works fine however in IE the swf stops downloading after 26k and as a result breaks the applicaition. I am using the movieclip loader. Any suggestions on how to fix this?
July 1st, 2007 at 3:55 pm
[…] ype: text/html I have spent many hours to solve this stupid bug. Luckily, I found this post. In short, I had to send this header: header(’Cache-Control: cache, must-revalidate’); head […]
July 9th, 2007 at 12:53 am
Thank you guys, i can not imagine how many hours you saved. :)
July 17th, 2007 at 3:08 am
<% response.setHeader(”Cache-Control”, “no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0″); %>
<% response.setHeader(”Content-Type”, “application/xml”); %>
July 19th, 2007 at 5:07 pm
canuckster - You’ve made my day. I’ve been struggling with this error for a couple of hours. I’m using FLEX2 APP HTTPS+PHP+MySQL. Everything works fine under FF but under IE It gave me this 2032 stream error. I have tried different combinations and finally yours did well. I have just placed these two lines of code :
header(”Cache-Control: cache, must-revalidate”);
header(”Pragma: public”);
after
session_start();
Thank you very much again!
July 23rd, 2007 at 9:55 pm
I’ve been fighting with this for a few days…Flex 2 app grabbing dynamic XML via HTTPS from a remote server. XML loads OK in FF but not IE. I have observed that in IE6, Options,Advanced,Security section there is a checkbox “do not write encrypted files to disk”. this is normally unchecked, but checking this is one solution to the problem. It seems the IE developer got this all wrong (imagine that), but that isn’t much of a solution for me since I have hundreds of users and asking them to click that is not gonna work. If I alter the response headers from the server supplying the dynamic XML to “cache-control: cache”, the XML loads, but any subsequent call to that same service will do exactly what that header is intended to do…and returns the same XML file, regarless if the data on the other end has actually changed between calls…that isn’t going to work either. I am working with another developer (from the company supplying the XML) to try different options of header directives to see what may work. I intend to try no-store, and various values of Expire or providing an Expire date. Hopefully something here will work. One thing for sure though, setting the response header to include a cache control directive of cache is not the answer as I need ‘real time’ data in the XML returned.
August 15th, 2007 at 3:05 am
[…] ed to this blog post. However, according to my testing, and the word of my esteemed colleague, Robert Reinhardt, this i […]
September 24th, 2007 at 10:58 pm
Just wanted to say thanks!
I added
header (”Cache-Control: cache, must-revalidate”);
header (”Pragma: public”);
to my PHP file right after start, and the Flash sendAndLoad calls in my clients application are working on IE7 now. Before this code was added, my app would return undefined and and sendAndLoad.
Thanks!
Joel
Newmediasoup, LLC
October 11th, 2007 at 8:18 pm
[…] : Nasty XML load bug in Internet Explorer Posted by Brian Busche under ActionScript lessrain blog » Blog Archive » Flash: Nasty XML load bug in Internet Explorer Loading XML files in Flash o […]
October 12th, 2007 at 8:42 pm
If you get #2032 stream error when accessing ASP.NET based Webservices from Flash in IE over HTTPS, you need to set the cache control programmatically. The challenge is IIS settings aren’t enough and unlike ASP.NET web page, web services cannot access Response.Headers directly.
USe this code (C# ASP.NET 2.0 Webservices):
[WebMethod]
public Response DoSomething() {
HttpCachePolicy cache = HttpContext.Current.Response.Cache;
cache.SetExpires(System.DateTime.Now);
cache.SetCacheability(HttpCacheability.Public);
cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
cache.SetValidUntilExpires(true);
cache.SetNoServerCaching();
November 7th, 2007 at 10:59 pm
[…] esday November 07th 2007, 11:59 pm Filed under: Blogroll A post on the lessrain blog, Nasty XML Load Bug in IE6, just prevented my day from being ruined. Apparently, there a […]
November 8th, 2007 at 2:00 pm
Thanks, thanks, thanks, thanks, thanks, thanks, thanks !
I’ve spent hours on that bug and sending header(’Pragma: no-cache’); solved the problem !
November 27th, 2007 at 9:56 pm
Thank you man!
Thanks. You saved our asses!!!
December 1st, 2007 at 12:15 am
[…] urday December 01st 2007, 12:16 am Filed under: Blogroll A post on the lessrain blog, Nasty XML Load Bug in IE6, just prevented my day from being ruined. Apparently, there a […]
December 6th, 2007 at 11:54 pm
[…] can say is sorry for the troubles and thanks for the patience. Resources: A blog post on lessrain.com (says it happens only with HTTPS but it also seems to happen with HTTP) A post I wrote a while a […]
December 7th, 2007 at 12:27 am
Thanks also from http://viibee.com.
I also wrote a bit about our problem on the viibe blog: http://viibee.com/blog/?p=33
Pascal
December 10th, 2007 at 10:12 pm
[…] kkejä ongelman ratkaisuun otetaan kiitollisena vastaan. Lisää aiheesta voi lukea vaikka lessrain.comin blogista.
Jätä vastaus
[…]
March 14th, 2008 at 9:32 am
Thanks for a lot of good info. I use FusionCharts where a flash component reads from a xml page (jsp page with ContentType=XML). I’ve tried several of the solutions displayed on the blog but nothing works. I currently set the header on the XML page as following:
response.addHeader(”Cache-Control”, “cache,must-revalidate”);
response.addHeader(”Pragma”, “public”);
response.setContentType(”application/xhtml+xml”);
Tried both setHeader and addHeader.
When I try a system.println before and after the headers I get nothing. Like if the component never even starts reading the xml file. This works well in firefox and I get the both printlines.
March 22nd, 2008 at 6:45 pm
Thank you so much!
April 16th, 2008 at 11:17 am
Thanks so much. You helped me figure out the issue that has been plaguing our site for for some time now. Much respect for this post.
April 18th, 2008 at 8:21 pm
[…] in IE7, this was not causing my problem. However, some comments on judad’s blog and on this blog were interesting: An Adobe TechNote warns of this issue. However, the note was last updated in 2005 […]
May 7th, 2008 at 1:18 pm
I’ve been working on a project in which we were generating a flash based menu. It was all working fine until we implemented Verisign SSL on the site. When we access the site via HTTPS it runs into some issues. After a round of ‘googling’, I figured out that there was an issue with IE and SSL that was causing this issue. I found a workaround that I’d like to share
http://sanjevsharma.blogspot.com/2008/02/flash-player-issues-with-secure-sockets.html
June 4th, 2008 at 3:26 pm
You can try using Other Alternate Browsers, if problem is really with your Internet Browser or the system.
July 1st, 2008 at 6:38 pm
Thanks.
August 7th, 2008 at 8:39 pm
Thank you soooo much!!! session UNDERSCORE cache UNDERSCORE limiter (privatenoexpire) did the trick for me!!!!
I tried to call a php-service over https. firefox works fine, but ie7 gives me this f*cking error 2032!
http://www.php.net/sessioncachelimiter was the solution for me!