Issue
- Opening the HTML source of the home page in a website made with Liferay DXP, customers may notice the following script injected:
Liferay.Session = new Liferay.SessionBase({
autoExtend: !0,
redirectOnExpire: !0,
redirectUrl: "https://www.myproductionwebsite.com/web/guest/home",
sessionLength: 900,
warningLength: 0
});
This may be wrong as, in most of the cases, in a real-life scenario, the path /web/guest/home does not exist and, as an effect, DXP users will be brought to a non-existing page upon session expiration.
Environment
- Liferay DXP 7.0+
Resolution
-
You may leverage the
/web/guest/home
part from the portal's interface: left Product Menu > Control Panel > Configuration > Instance Settings > Configuration > Navigation > Home URL where the tooltip states:"This is the home page of the Liferay instance. For example, if you want the home page to be http://localhost:8080/web/guest/home, set this to /web/guest/home."
Additional Information
- The tag is injected by this code: https://github.com/liferay/liferay-portal/blob/7.0.x/portal-web/docroot/html/common/themes/session_timeout.jspf#L34
redirectOnExpire: <%= SSOUtil.isSessionRedirectOnExpire(themeDisplay.getCompanyId()) %>