Configuring Caching for Documents and Media
Liferay 7.3 U23+, Liferay 7.4 U21+, GA21+
By default, Documents and Media files are not cached by browsers or servers. This is because file visibility generally depends on dynamic properties and configurations (e.g., permissions). However, you can enable and configure caching if desired.
Caching configurations only apply to documents that are visible to the Guest role.
Follow these steps to configure caching for your Liferay system or instance:
-
Open the Global Menu (), go to the Control Panel tab, and click System Settings or Instance Settings. See Understanding Configuration Scope to learn more about scoping configurations.
-
Go to Documents and Media → Cache Control.
-
Select a Cache Control policy.
-
Private: Allows caching by a user’s browser
-
Public: Allows caching by a CDN or proxy server
-
-
Set the Max Age for cached documents. This value determines the number of seconds a response is considered fresh. After the set time, the cached document version expires and requires refreshing. Leaving the value at
0
is equivalent to not specifying a value. -
(Optional) Enter a list of MIME types to exclude from caching (e.g.,
application/pdf
,image/jpeg
,video/mp4
).TipIf you have MIME types that are frequently updated, you can disable caching for that type to ensure the latest version of the file appears to users.
-
Click Save.