8 Replies Latest reply on Jun 23, 2013 11:25 PM by voldy2003

    SWF file being cached en-route

    Richard_Abbott Level 3

      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,


        • 1. Re: SWF file being cached en-route

          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.

          • 2. Re: SWF file being cached en-route
            Richard_Abbott Level 3


            pretty much as you say. We are going over a company network for some end-user evaluation before working out a long term deployment. Previous to this the in-house team had just been working over the intranet with no problems, but now over a wider network the problem has emerged. You may be right that it is the proxy server getting in the way - no-cache directives seem to work on the ASP container pages, but the SWF is obviously viewed just as a resource and is not updated. Yes, localhost access does work still. Temporarily I have worked around by adding an index suffix.


            • 3. Re: SWF file being cached en-route
              *Prashant Shelke* Level 4

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


                      <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"/>



              • 4. Re: SWF file being cached en-route
                Richard_Abbott Level 3

                Prashant Shelke,

                thanks for the suggestion, but looking around at information on services-config it seems to be something a Flex app uses to talk to remote objects, whereas the problem I have is with the Flex app as a whole being cached at a proxy server. I can't quite see how the two correspond?


                • 5. Re: SWF file being cached en-route
                  ChristopherBos Level 1

                  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')#</cfoutput>", "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.

                  1 person found this helpful
                  • 6. Re: SWF file being cached en-route
                    Richard_Abbott Level 3


                    thanks for this, I'll look into it. Typically I use the JavaScript AC_FL_RunContent means of instantiating the Flex app, but I guess I can adapt your suggestion using additional parameters to do much the same. Your answer much appreciated,


                    • 7. Re: SWF file being cached en-route

                      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 ??

                      • 8. Re: SWF file being cached en-route
                        voldy2003 Level 1

                        this solved my caching issue !