Search code examples
htmlflashcrossdomain.xml

crossdomain.xml prevent caching


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?


Solution

  • 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.