Issue
-
The implementation of a servlet filter for friendly URLs is causing issues. It works as expected without Virtual host configuration, but when the virtual host is configured, a filter is not invoked.
Environment
- Liferay DXP 7.4 update 23
Resolution
-
The root cause is VirtualHostFilter changing the URI from '/' to '/web/guest', causing the filter's URL pattern to no longer match. As a result, it appears that the following needs to be added to the respective code:
"url-pattern=/web/guest/*", "url-pattern=/"
"before-filter=Virtual Host Filter"
For example:
@Component(
immediate = true,
property = {
"before-filter=Virtual Host Filter", "servlet-context-name=",
"servlet-filter-name=redirectLoggedUsersFilter",
"url-pattern=/web/guest/*", "url-pattern=/"
},
service = Filter.class
)
Additional Information
- We have a separate channel called "Global Service Team" that can provide additional assistance with code level or any development area.