RE: Multiple Virtual Hosts and /web/guest

thumbnail
Fredi B, modified 5 Years ago. Junior Member Posts: 69 Join Date: 4/1/20 Recent Posts
Hello Liferay-Community,
I managed to prevent /web/guest in the URL for Guests on my Liferay-Site by setting up the Virtual Host to the Domain of my site.

Sadly this is only working with or without the www Subdomain.
Virtual Host: www example com -- /web/guest will not be shown for visitors of my site using www example com
Virtual Host: example com -- /web/guest will not be shown for visitors of my site using example com 

Is there a way to hide /web/guest for both options?

Cheers,
Fredi
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
The simplest solution is to add a redirect in the reverse proxy. Decide, which url you like and then redirect e.g. from www.myhost.com to myhost.com.
That way, you only need one virtual host entry. This is probably the best solution. If possible, sites should have just one url.
Other ways are more complicated. You could implement your own filter that does whatever is necessary. Or maybe you can use a Wrapper for VirtualHostLocalService that treats www.myhost.com and myhost.com the same.
Note: Liferay 7.3 allows you to set multiple virtual hosts.