crossdomain.xml prevent caching
Asked Answered
M

4

6

After changing domain name where flash application being hosted I should change crossdomain.xml file. That crossdomain.xml is hosted on api-server, which is used by flash application. I see that flash uses crossdomain.xml from browser's cache. Is there any trick to make flash to not get crossdomain.xml from cache? Maybe there is any parameter, that I can pass to flash during it's call in object tag?

Mineralogy answered 10/2, 2011 at 10:41 Comment(0)
R
5

Annoying issue - no doubt.

First of all: I like Caching - as long as I'm in control. This is, how I gain control over crossdomain.xml caching:

Let's say, we have a flash app that requires some input from a different server. In my case we have this configured as a flashvar dataSrc=http://www.company.com/data/calendar.xml

So flash is looking for www.company.com/crossdomain.xml ... which is loaded once and than taken from users browser cache until he manually flushes it.

The solution is in changing the subdomain the crossdomain.xml ist taken from:

Make sure, that for example(!) noCache.company.com/ points to company.com's documentRoot. Flashvar is modified to dataSrc=http://noCache.company.com/data/calendar.xml. In fact, you're addressing the same file as before.

Flash is looking for noCache.company.com/crossdomain.xml which will be taken from the Server now because there is no cached file for that uri.

It's up to your fantasy... if you allow subdomains like noCache_{numeric_value}, you could easily handle your own TTL by accessing http://noCache_{week_of_year}.company.com/data/calendar.xml ...

You can as well increment that numeric value each time crossdomain.xml has changed.

Retainer answered 16/8, 2011 at 16:52 Comment(2)
Yes, I have resolved my problem in similar way. Was still waiting for solution managing with only flash settings. But it seems that or there is no solution using only flash settings, or nobody knows it. That is why I accept this answer as working solution. Thanks.Mineralogy
Thank you! I would prefer (demand?) a flash configuration way too. This is such a common issue...Retainer
A
1

Use following apache directives to specify caching policy for the file:

<Directory /var/www/mysite>
  <FilesMatch "crossdomain.xml">
    Header set Cache-Control "max-age=86400, public, must-revalidate" 
  </FilesMatch>
</Directory>
Argueta answered 13/9, 2011 at 14:25 Comment(0)
P
0

I append random numbers to the end of xml files if I don't want them to cache eg. var myXMLURL:String = "myXML.xml?r=" + Math.random()*1000;

The browser sees it as a different file eg. myXML.xml?r=645 / myXML.xml?r=239

I'm not sure if this would work with crossdomain.xml files, but it should be worth a quick try.

Prance answered 11/2, 2011 at 15:59 Comment(3)
As I understand crossdomain.xml is called by internal mechanisms of Flash. If you know how to influence on this request, and add to it parameters, please share.Mineralogy
Flash requests a crossdomain.xml at the base of the domain by default, but you can set it by calling Security.loadPolicyFile(str:String); livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/system/…Prance
@TrevorBoyle: I've been unable to get Security.loadPolicyFile() to actually do anything once an old version of crossdomain.xml has already been cached, is there something obvious I might be overlooking?Backsheesh
R
-3

I would forced reload (F5 or CTRL/CMD-F5) the crossdomain.xml file directly in the browser until I see it changes. Just type in the crossdomain file's URL in the browser and keep on refreshing. Also I would clean the browser cache.

You should try Firefox and firebug which shows you whether the downloaded files are cached or not.

http://getfirebug.com/

Good luck, Rob

Resentment answered 10/2, 2011 at 10:47 Comment(1)
Thanx for answer, but me is not the only man who wants to see site working. There are a lot of others who want to use it. Suppose that I can not physically directly reload crossdomain.xml using their browsers )Mineralogy

© 2022 - 2024 — McMap. All rights reserved.