Using Custom Landing Page for Error Codes does not Work with /image/ in the URL
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.
Issue
- When designing a custom landing page that displays a 404 Error code, invalid URLs that have /image/ in the URL string should display the customized page placed either in the
/webapps/ROOT/html/portal folder or a site page.
Environment
Resolution
- This is intended behavior.
- When accessing a non-existent URL such as localhost:8080/web/guest/abc, since the page is not found, it displays the custom "not found" page.
- However,
/image/ is a servlet mapping (as can be seen here: https://github.com/liferay/liferay-portal/blob/7.0.x/portal-web/docroot/WEB-INF/web.xml#L940-L943). When hitting a URL such as localhost:8080/image/abc, it triggers the WebServerServlet and tries to find an image within the Document Library.
- Since the page itself exists (containing the
WebServerServlet) but the image does not, it does not display the custom 404 "not found" page, but instead the standard Liferay DXP 7.0's "resource not found" page.
Did this article resolve your issue ?