Legacy Knowledge Base
公開されました Jul. 2, 2025

Liferay Experience Cloud で HTTP ステータス エラーを処理する方法

Written By

Rodrigo Mier

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

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

問題

  • Nginx を使用して、Liferay の外部で各 HTTP ステータスのリダイレクトを構成する方法。
  • Liferay 内では、いくつかの関連する動作を管理できます。
    • 次のプロパティを使用して、404 エラーのページへのリダイレクトを定義できます。
      • sites.friendly.url.page.not.found=/html/portal/404.html
    • または、次のプロパティを使用して HTTP ステータスを表示します。
      • layout.show.http.status=true
  • DXPCloud を使用すると、この HTTP 404 およびその他の HTTP ステータスを Web サーバーから管理できます。

Environment

  • Liferay エクスペリエンス クラウド

解決策

  • Nginx は HTTP エラーをインターセプトし、静的ページを提供できます。
    • この機能を有効にするには、 proxy_intercept_errors on; を追加するだけです。 フラグを Web サーバー構成ファイルに追加します。
    • その後、各エラーを HTML ページと PATH に再マップします。

例として、この構成は HTTP 404 エラーをリダイレクトします。

location / {
# auth_basic "Authentication Required";
# auth_basic_user_file /var/www/html/.htpasswd;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-Forwarded-Port $http_x_forwarded_port;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $http_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_pass http://127.0.0.1:81;
proxy_intercept_errors on;

error_page 404 /code404.html;

location = /code404.html {

root /var/www/html/;
internal;
}
}

追加情報

Did this article resolve your issue ?

Legacy Knowledge Base