Skip navigation
Richard_Abbott
Currently Being Moderated

SWF file being cached en-route

Jun 11, 2009 4:50 AM

Hi all,

I appreciate this is not exactly a Flex question but perhaps someone will have some suggestions. The SWFfile being used in our application is being cached somewhere between server and client. Let me emphasise that this is not a problem of getting fresh data from URLLoader requests _inside_ the application (for which one adds timestamps) nor one of the containing page (this has HTTP headers to avoid caching which are being honoured), but the main SWF file itself. We have tested by clearing the browser cache, restarted the web server etc, but the problem persists.

We could work around in a rather hacky way by renaming the SWF each time (say putting a suffix on) but I was hoping for something more generic analogous to no-cache directives for the web pages.

Any ideas? Thanks in advance,

Richard

 
Replies
  • Currently Being Moderated
    Jun 11, 2009 5:51 AM   in reply to Richard_Abbott

    Richard, I faced the similar problem. When I was using my company network, client application (flex application) is picking the swf file from the proxy server rather than the application server. I tried some other network i.e. from my home machine & using client network, it worked.

    So, I just want to know what problem you are facing. I mean what type of network are you using? If you test the application on the localhost, I hope it would work. So, it seems that the problem is with the network not with the application.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 11, 2009 7:45 AM   in reply to Richard_Abbott

    You try with this change, in WEB-INF\flex\services-config.xml

     

    <channels>
            <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
                <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
                <properties>
                    <add-no-cache-headers>false</add-no-cache-headers>

     

    Thanks.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 12, 2009 10:56 AM   in reply to Richard_Abbott

    The simplest way to avoid the proxy cache is to attach a random number to the swf file in the embed tag (Or whatever you use to embed your flash/flex app) so for swf object it looks something like this:

     

    swfobject.embedSWF("swf.swf?<cfoutput>#TimeFormat(now(),'hhmmss')#</cf output>", "someswf", "917", "407", "9.0.115", "swf/expressInstall.swf", flashvars, params, attributes);

     

    I'd suggest using a version number instead of the timestamp, smart proxy servers will cache the full url content unless otherwise directed or if the page is accessed via a Post rather than a Get. And the caching can be handy in production (Or just remove the querystring from your production build but leave it in for the dev server).

     

    Don't forget you might need to do the same for assets (Video/Images) loaded from inside the .swf as well.

     

    More complex solutions would be to change your web server config to add the no-cache headers.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 17, 2013 12:54 AM   in reply to ChristopherBos

    your approach is working ...

    but i even tried to change Output Folder path(right Click on project >Flex Build Path > there ull find Output Folder)

     

    after ever change i update the version no of the folder ,, test1.1, test1.2 and so on...

    under this test folder are my SWF's

     

     

    will this solve the issue of proxy caching ??

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 23, 2013 11:25 PM   in reply to voldy2003

    this solved my caching issue !

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points