legacy-knowledge-base
公開されました Sep. 10, 2025

liferay-web.xml ファイルのリソースの Cache-Control ヘッダ設定を上書きする

written-by

Justin Mann

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

learn-legacy-article-disclaimer-text

問題

  • /document/パスを介して提供されるリソースのCache-Controlヘッダー設定を上書きするにはどうすればよいですか? lifery-web.xmlを更新して、そのurlパターンのサーブレットフィルターを追加しようとしましたが、変更は適用されていません。

環境

  • Liferay DXP 7.0

解決

  • 以下のプロパティが設定されている場合に発生する可能性があります。
    • com.liferay.portal.servlet.filters.header.HeaderFilter=false
  • この設定は、portal-developer.propertiesファイルでデフォルトで設定され、ヘッダーフィルタを無効にすることで、システムがliferay-web.xmlで設定された変更を読み込まなくなります。 portal-developer.properties ファイルの使用を無効にするか、プロパティを true に設定すると、liferay-web.xml ファイルで設定されている内容に従って Cache-Control ヘッダが上書きされます。

追加情報

  • デフォルトでは、Liferayはドキュメントライブラリ内のすべてのドキュメントと画像のキャッシュを無効にし、"Cache-Control: private "を設定します。
  • ヘッダーフィルタが無効になったら、/webapps/ROOT/WEB-INF/にあるliferay-web.xmlファイルに以下のフィルタマッピングを追加して、Cache-controlの値を設定することができます。
    • <filter-mapping> 
      <filter-name>Header Filter</filter-name>
      <url-pattern>/documents/*</url-pattern>
      </filter-mapping>
did-this-article-resolve-your-issue

legacy-knowledge-base