Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 363
Dao Avatar asked Feb 10 '11 10:02

Dao


People also ask

Can I delete Crossdomain xml?

The crossdomain. xml file is only used by SWF files that leverage Adobe Flash External Interface API. If this API is not being tracked then the crossdomain. xml file can safely be removed from the On Premises SDC (SmartSource Data Collector) document root.

What is Crossdomain xml and why do I need it?

A cross-domain policy is simply a user-defined set of permitted data access rules encapsulated in a crossdomain. xml file. It is only viable on servers that communicate via HTTP, HTTPS, or FTP. A cross-domain policy file is an XML document that grants a web client permission to handle data across one or more domains.

Do I need Crossdomain xml?

xml. A cross-domain policy file is needed for Flash. It is an XML document that grants a web client, such as Adobe Flash Player permission to handle data across domains.

What is Crossdomain xml?

The crossdomain. xml file is a cross-domain policy file. It grants the Flash Player permission to talk to servers other than the one it's hosted on and is required for Flash to use Speedtest servers. Note there are two sources of crossdomain information for a Speedtest Server.


2 Answers

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.

like image 192
HBublitz Avatar answered Oct 02 '22 21:10

HBublitz


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>
like image 38
Arie Skliarouk Avatar answered Oct 02 '22 21:10

Arie Skliarouk