Issue
- With the following property
the cache headers are not being set with other content types such as text/css, text/javascript, img/pngbrowser.cache.disabled=false
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 astext/css
,text/javascript
,img/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, theJSResolveModulesServlet.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
Subscriber Exclusive Content
A Liferay Enterprise Subscription provides access to over 1,500 articles that include best practices, troubleshooting, and other valuable solutions. Sign in for full access.
Sign In