Cache Control header for other content type

Issue

  • With the following property
    browser.cache.disabled=false
    the cache headers are not being set with other content types such as text/csstext/javascriptimg/png 

Environment

  • Liferay DXP 7.4

Resolution

  • The browser.cache.disabled property is checked from the MainServlet and a few other less common servlets. This means that the responses of those servlets would emit the cache control headers for the resources they serve. In the case of MainSerlvet, this means portal pages (basically, HTML content). Nevertheless, other resources get served from different servlets. And those are not making use of that property to determine cache behavior.
    Therefore, the cache headers are not being set with other content types such as text/csstext/javascriptimg/png is expected behavior with the portal.
  • These other resources manage their own mechanism to invalidate caching, and different servlets control those headers depending on what they serve.
    For example, the JSResolveModulesServlet.java, which is in charge of serving module resolutions, set a particular value for those headers purposedly, in a non-configurable way.
    • Note: disabling caching of resources entails a very big performance penalty as any resource will be requested from the browser to the server every time a page is visited.

Additional Information

  • Disable Pragma: no-cache header
  •  #
    # Set this to true if you want the portal to force the browser cache to be
    # disabled. It will only disable the cache for the rendered HTML response.
    # It will not have an impact on static content or other resources.
    #
    # Env: LIFERAY_BROWSER_PERIOD_CACHE_PERIOD_DISABLED
    #
    browser.cache.disabled=true
Este artigo foi útil?
Utilizadores que acharam útil: 0 de 0