Issue
After configuring a virtual host in Liferay DXP 7.3, the /web/guest path segment cannot be removed from the site URL. Accessing the site without /web/guest results in the page continuously loading and a 404 error appearing in the logs.
Environment
- Liferay DXP 7.3
Resolution
This issue is caused by the VirtualHostFilter being disabled in portal-ext.properties. Follow the steps below to resolve it.
- Stop the application server. Before making any changes to
portal-ext.properties, stop the running Liferay instance. - Update portal-ext.properties. Open
{liferay_home}/portal-ext.propertiesand apply the following changes:- Enable the Virtual Host Filter. Find the line below and either remove it entirely or set it to
true:
com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter=falseSetting this to
falsedisables virtual host routing and causes the 404 behavior. - Set the default site for the virtual host. Add the following property to remove
/web/guest(or any other site path) from the default URL:
virtual.hosts.default.site.name=Guest
With this property set, the default URL changes fromhttp://localhost:8080/web/guest/hometohttp://localhost:8080/home. If the specified site has its own virtual host configured, that takes precedence; otherwise, the company virtual host is used. - Clear cached data Delete the contents of the following directories before restarting:
{liferay_home}/osgi/state{liferay_home}/work{liferay_home}/tomcat/temp{liferay_home}/tomcat/work
- Restart the application server. Start Liferay again. Changes to
portal-ext.propertiesonly take effect after a full server restart.
- Enable the Virtual Host Filter. Find the line below and either remove it entirely or set it to
Additional Information
- The
portal-ext.propertiesfile must always be updated while the server is stopped. Any changes made while the server is running will not be applied until a restart.