Legacy Knowledge Base
Published Sep. 10, 2025

Cache Control header for other content type

Written By

Kanchan Bisht

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

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
Did this article resolve your issue ?

Legacy Knowledge Base