Content Management and Capture

 View Only
Expand all | Collapse all

Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

  • 1.  Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Tue February 27, 2024 07:59 AM

    Hi,

    As the title describes we have a problem where user do not get the updated functionality from our custom Content Navigator Plugin when we deploy a new version.

    Our quick fix today is to tell users to clear the browser cache and reopen browser. This is not a good solution for us, since we are privileged to have many users of Content Navigator, and each of them need to perform this operation.

    How can we come around this without telling users to clear browser cache each time we deploy a new version?

    Are there some settings in Content Navigator we can switch on or can I create a plugin that will clear cache for the user(this feels like working against Content Navigator)?

    Appreciates any post <3



    ------------------------------
    Andreas Baaserud Hauge
    Senior Consultant
    tietoevry
    ------------------------------


  • 2.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Tue February 27, 2024 12:05 PM

    You can use dojo build file to generate a jgz file for your plugin with version number in the file name. 

    you can reference samples from here GitHub.

    ibm-content-navigator-samples/samplePlugin/build.xml at master · ibm-ecm/ibm-content-navigator-samples · GitHub



    ------------------------------
    WENTAO LU
    ------------------------------



  • 3.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Tue February 27, 2024 03:15 PM

    @WENTAO LU - are you saying adding a unique filename of the jar file will force the clients browser to reload the javascript files of the content navigator plugin?



    ------------------------------
    Andreas Baaserud Hauge
    Senior Consultant
    tietoevry
    ------------------------------



  • 4.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Tue February 27, 2024 05:55 PM

    basically the concept is to use a unique filename (not necessary the name of the jar itself). Inside your plugin jar file, you will have such structure as below:

    /WebContent

     -  yourplugin-1.0.0.css.jgz

     - yourplugin-1.0.0.js.jgz

    and in "yourplugin.java"

     public String getScript()
      {
        return "yourplugin-1.0.0.js.jgz";
      }
        
      public String getCSSFileName()
      {
        return "yourplugin-1.0.0.css.jgz";
      }

      

     



    ------------------------------
    WENTAO LU
    ------------------------------



  • 5.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Thu February 29, 2024 03:59 PM

    @ANDY Choi, @Mathias Korell, what do you think about this?
    is it best practice use to use unique filename?



    ------------------------------
    Andreas Baaserud Hauge
    Senior Consultant
    tietoevry
    ------------------------------



  • 6.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Fri March 01, 2024 08:21 AM

    Hi Andreas, it was the option of choice to achieve the same before having worked out the cache-control header field option. Would not necessarily call it a best practice though, as it requires both code and build file changes aligned, that's why it fell through our requirements and we continued digging. 



    ------------------------------
    Mathias Korell
    ------------------------------



  • 7.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Wed February 28, 2024 02:12 AM

    The customer also can try to add this to ESAPI WAF policy file:

    <add-header name="Cache-Control" value="no-cache" path=".*/plugin/.*/getResource/.*"/>

    And it will be added into next release, ICN 3.0.15 iFix 2 (end of April), 3.0.14 iFix 5 (end of April), and 3.0.11 iFix 16 (end of March)



    ------------------------------
    JIE ZHANG
    ------------------------------



  • 8.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Wed February 28, 2024 02:56 AM

    Thanks a ton for sharing!

    Inside file install_dir/WEB-INF/ESAPIWafPolicy.xml.default

    Default value for 3.0.11 seems to be

    <add-header name="Cache-Control" value="no-cache, no-store" path=".*/|.*\.jsp|.*/jaxrs/.*|.*/api/.*"/>

    Would this be the new path value?

    <add-header name="Cache-Control" value="no-cache, no-store" path=".*/|.*\.jsp|.*/jaxrs/.*|.*/api/.*|.*/plugin/.*/getResource/.*"/>


    ------------------------------
    Andreas Baaserud Hauge
    Senior Consultant
    tietoevry
    ------------------------------



  • 9.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Thu February 29, 2024 07:22 AM

    Some updates from me after testing a few things.

    I added a new entry for Cache-control inside ECMClient/config/ESAPIWafPolicy.xml.default

    Following Cache-Control headers active

    <add-header name="Cache-Control" value="no-cache, no-store" path=".*/|.*\.jsp|.*/jaxrs/.*|.*/api/.*"/>
    <add-header name="Cache-Control" value="no-cache" path=".*/plugin/.*/getResource/.*"/>

    If you look at the path value it is equal to .*/plugin/./getResource/.

    My javascript are not being reloaded with this setup

    I have then tried to specify the specific javascript I need to reload

    <add-header name="Cache-Control" value="no-cache" path=".*/plugin/MyPlugin/getResource/MyPlugin.js"/>

    I still see old content of MyPlugin.js

    Below .*/plugin/./getResource/. I have both javascripts and css among other resources - but I dont see MyPlugin.js under plugin/MyPlugin/getResource/ when inspecting the browser with developer tool.

    Any ideas?



    ------------------------------
    Andreas Baaserud Hauge
    Senior Consultant
    tietoevry
    ------------------------------



  • 10.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Thu February 29, 2024 09:24 AM

    Hi Andreas,

    Did you clear the browser cache before you do another set of tests?

    Do you see the Cache-Control response header set to no-cache for the request made to retrieve plugin/MyPlugin/getResource/MyPlugin.js?

    What value do you see as the Last-Modified response header?

    Do you see the browser including the If-Modified-Since header when requesting the file?

    The server should respond with 304 Not Modified when the If-Modified-Since and the Last-Modified header values match or with 200 along with the content otherwise.

    Regards,

    Andy



    ------------------------------
    ANDY Choi
    ------------------------------



  • 11.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Thu February 29, 2024 09:44 AM

    Hi @ANDY Choi

    Isn't the whole point not to clear browser cache - ref APAR IO29417 

    If I clear browser cache, everything is good - but this is no solution as I cannot do that for all of our users.



    ------------------------------
    Andreas Baaserud Hauge
    Senior Consultant
    tietoevry
    ------------------------------



  • 12.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Thu February 29, 2024 11:09 AM

    The browser will continue using the prior cache that was made with responses excluding the Cacheh-Control header until its default lifetime of the cache is reached so the fix would only apply after any prior cache is cleared. You should no longer need to clear the browser cache manually once the browser starts using the cache made with responses including the Cache-Control header set to no-cache. To verify the fix, you can clear the browser cache manually, load the plugin resources, verifiy the browser uses the cache on subsequent calls, update the plugin with updated resources, and check if the browser clears the cache automatically and uses the updated plugin resources.



    ------------------------------
    ANDY Choi
    ------------------------------



  • 13.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Thu February 29, 2024 03:25 PM

    That seems to work just fine - thought perhaps didnt need to clear cache first time.

    So this is good.

    Thanks.

    The fixpack 16 for version 3.0.11 - regarding Cache-Control, will it do something else than adding extra Cache-Control header like this in ESAPI WAF API Policy?

    <add-header name="Cache-Control" value="no-cache" path=".*/plugin/.*/getResource/.*"/>


    ------------------------------
    Andreas Baaserud Hauge
    Senior Consultant
    tietoevry
    ------------------------------



  • 14.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Fri March 01, 2024 11:32 AM

    Additional code changes are being added to fix the caching issue for plugin resource files that are compressed with the file extension .jgz which you may not need if you're not compressing your plugin resources files.



    ------------------------------
    ANDY Choi
    ------------------------------



  • 15.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Wed February 28, 2024 02:14 AM

    Hi Andreas, this has been recently discussed and led to APAR IO29417 , addressed with current releases of ICN. You can implement a custom ESAPI WAF API Policy and add an entry as described in the APAR Description, which should eliminate the concern. 



    ------------------------------
    Mathias Korell
    ------------------------------



  • 16.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    IBM Champion
    Posted Wed February 28, 2024 05:15 AM

    And...

    https://www.ibm.com/docs/en/content-navigator/3.0.15?topic=security-protecting-your-web-application-by-using-firewall



    ------------------------------
    Gerold Krommer
    ------------------------------



  • 17.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Thu February 29, 2024 08:32 AM

    Hi Mathias,

    Question about this sentence in the APAR -  Does it require an ICN app server restart to pickup the change? or doe the simple act of reloading the plugin via the ICN Admin desktop also work?

    With this fix, the
    browser cache is refreshed automatically once the plugin is
    updated, all ICN servers are restarted, and the browser is
    reloaded."


    ------------------------------
    Chuck Hauble
    Minneapolis MN
    ------------------------------



  • 18.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Thu February 29, 2024 09:07 AM

    Hi Chuck, the updated JS files are packaged into a jar file which per the best of my knowledge is only loaded during JEE server restart. Accordingly, I assumed the technote to be correct. Didn't bother us in a clustered environment, anyway. 



    ------------------------------
    Mathias Korell
    ------------------------------



  • 19.  RE: Client side Browser Cache prevent update of new version of custom Content Navigator Plugin

    Posted Thu February 29, 2024 09:10 AM
    Edited by Andreas Baaserud Hauge Thu February 29, 2024 09:30 AM

    Hi Mathias, for some reason I can't access the APAR - would it be possible that you show me the suggested "custom ESAPI WAF API Policy"?

    Im sure our company should have access - might be something with my user setup in IBM

    Never mind, I am able to see the APAR now.

    I have tried what is described in the APAR, please see my post earlier today related to my tests



    ------------------------------
    Andreas Baaserud Hauge
    Senior Consultant
    tietoevry
    ------------------------------