Serg Shapoval
Serg Shapoval

Reputation: 717

Cache expired time for all pages in liferay

Is it possible to set cache expired time for whole pages in liferay? I found next solution but it's disabling caching in browser at all. Is it possible to set expiring time for whole pages?

#
# 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.
#
browser.cache.disabled=true

#
# Set this true if you want to disable the cache for authenticated users.
# This property is not read when the property
# "browser.cache.signed.in.disabled" is true. This is useful to ensure that
# authenticated users cannot go to the sign in page by clicking on the back
# button in their browsers.
#
browser.cache.signed.in.disabled=true

Upvotes: 2

Views: 1553

Answers (1)

jorgediaz-lr
jorgediaz-lr

Reputation: 982

You can set 'Expires' header configuring liferay HeaderFilter filter:

Liferay filters are configured in WEB-INF/liferay-web.xml, default configuration is:

Out of the box, Liferay only adds "Expires" and "Cache-control" headers to some URL patterns, see:

So you have to create:

  1. new filter entry with the headers you want to add
  2. new filter-mapping with the urls you want to modify

Upvotes: 3

Related Questions