Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what are the pros and cons of setting virtual host in Liferay?

I am using multiple domains to access liferay portal instance.

For example following are the domains mapped in hosts file of windows:

  1. www.liferaytest1.com
  2. www.liferaytest2.com

and in Liferay's Control PanelPortal Settings, www.liferaytest1.com is set as virtual host.

I can access portal instance with all above mention domains along with localhost.

When I access portal with www.liferaytest1.com then I can access Guest site pages directly. Say, home is a page in Guest site then instead of accessing with www.liferatest1.com/web/guest/home I can access it directly with www.liferaytest1.com/home

So URL is shortened to some extend.
So far so good.

First Concern

Now when I try to access portal via www.liferaytest2.com and when I click any sites listed in My Sites portlet of Liferay, it redirects me to that site with the domain mentioned in virtual host i.e. www.liferaytest1.com instead of retaining www.liferaytest2.com.

Suppose I have a Site named Help, so when I click on help site link in My Sites portlet then instead of staying with www.liferaytest2.com domain it redirects me with www.liferaytest1.com domain.

This is due to virtual host mapping done in liferay.

Second Concern

When I am accessing the portal with www.liferaytest2.com and subscribe to any of the Assets then the links in email contain the virtual host domain i.e www.liferaytest1.com.


How to overcome above mention issues?

My requirement is to stay relative to the portal accessing domain.
When I access portal via www.liferaytest2.com then it should not redirect me to www.liferaytest1.com on-click of any of the Site-links as explained above and also emails that I would be getting should also be relative to the domain I am accessing i.e. www.liferaytest2.com.

like image 328
suyash Avatar asked Nov 12 '22 02:11

suyash


1 Answers

First of all: You're not required to use that feature - it's implemented in a certain way (e.g. as you describe) and if that doesn't suit your needs, there's no need to configure individual virtual hosts. There's no problem serving all content through just a single virtual host or do the resolution on Apache (e.g.) - that is, fully external to Liferay. The only drawback is that you'll need the clue of the site you want to access (e.g. /web/guest as part of the URL) so that Liferay knows what content to serve.

However, you might be closer to what you'd like to achieve if you change URLs to a structure like test1.example.com and test2.example.com - this way you share at least the toplevel domain and might be able to do some cheaper single-sign-on (you can still do SSO with completely different domains)

like image 96
Olaf Kock Avatar answered Dec 21 '22 18:12

Olaf Kock