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.

Important

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:

  1. Open the Global Menu (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.

  2. Go to Documents and MediaCache Control.

    Go to Cache Control under Documents and Media settings.

  3. Select a Cache Control policy.

    • Private: Allows caching by a user’s browser

    • Public: Allows caching by a CDN or proxy server

  4. 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.

  5. (Optional) Enter a list of MIME types to exclude from caching (e.g., application/pdf, image/jpeg, video/mp4).

    Tip

    If 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.

  6. Click Save.

Capabilities

Product

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy