Legacy Knowledge Base
Published Sep. 10, 2025

Unauthenticated Users are not redirected to the Login Page when accessing a Resource URL

Written By

Jose L. Bango

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 an unauthenticated user tries to access a resource URL (e.g., a direct link to a PDF served by a portlet), they are not redirected to the login page.
  • This behavior is observed for URLs that contain the p_p_lifecycle=2 parameter, which corresponds to the Resource Serving Phase of the portlet lifecycle.
  • We would like the user to be redirected to the login page and, after successful authentication, be redirected back to the originally requested resource.

Environment

  • Liferay DXP 7.0+

Resolution

This is the expected behavior of the platform and is compliant with the Java Portlet Specification 2.0 (JSR 286).

  • When a URL includes the p_p_lifecycle=2 parameter, it initiates the Resource Serving Phase. In this phase, the client (e.g., a web browser) is specifically requesting a resource, such as a file or JSON data, not an HTML page.
  • According to the portlet standard, the response must be the resource itself. Responding with a redirect to a login page (which is an HTML document, typically with an HTTP 200 or 302 status) would violate the specification for this lifecycle phase.
  • Therefore, Liferay cannot automatically redirect unauthenticated users to the login page for these types of resource requests.

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base