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?

Dao
  • 2,684
  • 3
  • 26
  • 34

4 Answers4

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.

HBublitz
  • 672
  • 4
  • 6
  • 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. – Dao Aug 16 '11 at 17:54
  • Thank you! I would prefer (demand?) a flash configuration way too. This is such a common issue... – HBublitz Aug 17 '11 at 07:37
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>
Arie Skliarouk
  • 417
  • 2
  • 11
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.

Trevor Boyle
  • 1,015
  • 7
  • 15
  • 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. – Dao Feb 11 '11 at 19:17
  • 3
    Flash requests a crossdomain.xml at the base of the domain by default, but you can set it by calling Security.loadPolicyFile(str:String); http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/system/Security.html#loadPolicyFile() – Trevor Boyle Feb 14 '11 at 20:29
  • 1
    @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? – Matt Kantor Oct 19 '11 at 21:12
-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

robertp
  • 3,019
  • 1
  • 15
  • 13
  • 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 ) – Dao Feb 10 '11 at 10:53