Fórumok

Pros and cons of setting Virtual host in liferay

Suyash Madhusudan Bhalekar, módosítva 10 év-val korábban

Pros and cons of setting Virtual host in liferay

New Member Bejegyzések: 24 Csatlakozás dátuma: 2012.09.04. Legújabb bejegyzések
I am using multiple domains to access liferay portal instance.

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

www.liferaytest1.com
www.liferaytest2.com


and in Liferay's Control Panel → Portal 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.
thumbnail
Hamish Campbell, módosítva 9 év-val korábban

RE: Pros and cons of setting Virtual host in liferay

Junior Member Bejegyzések: 87 Csatlakozás dátuma: 2008.08.20. Legújabb bejegyzések
same question (BUMP)
thumbnail
Krzysztof Gołębiowski, módosítva 9 év-val korábban

RE: Pros and cons of setting Virtual host in liferay

Liferay Master Bejegyzések: 549 Csatlakozás dátuma: 2011.06.25. Legújabb bejegyzések
I think this is how it works in Liferay and cannot be changed. You can always go to URL www.liferaytest1.com/web/liferaytest2site/page to get to Liferaytest2 site, but it is generally not recommended (you should use Virtual Host URLs and most Liferay-generated links will use them). If there is a problem that users have to log twice (for each domain separately), you should install some SSO solution like CAS, NTLM etc.

Regards,
KG
thumbnail
David H Nebinger, módosítva 9 év-val korábban

RE: Pros and cons of setting Virtual host in liferay

Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
With VHosts, you're saying the site is externally known as liferaytest1.com, and no other url. So when you're on a site tied to liferaytest2.com and you pick a site for liferaytest1.com, well then your URL is going to change.

If you want both liferaytest1.com and liferaytest2.com to stick, remove the virtual host mappings and just let both names resolve to the same server. Liferay will not try to change the URLs, so if you come in via liferaytest2.com, then you'll stay there.
thumbnail
Achmed Tyrannus Albab, módosítva 4 év-val korábban

RE: Pros and cons of setting Virtual host in liferay

Regular Member Bejegyzések: 158 Csatlakozás dátuma: 2010.03.05. Legújabb bejegyzések
David H Nebinger:

With VHosts, you're saying the site is externally known as liferaytest1.com, and no other url. So when you're on a site tied to liferaytest2.com and you pick a site for liferaytest1.com, well then your URL is going to change.

If you want both liferaytest1.com and liferaytest2.com to stick, remove the virtual host mappings and just let both names resolve to the same server. Liferay will not try to change the URLs, so if you come in via liferaytest2.com, then you'll stay there.

I am using liferay 7.1, my intention is almost if not the same.
I have www.abc.com and admin.abc.com , i want both to point to the same liferay. 
I have already disabled (by removing) the virtual host in CMS at Site>Configuration>Site Settings>General Tab>Removed earlier set url which was www.abc.com . Still if i go to admin.abc.com the url will change back to www.abc.com .

Is there anymore setting that i need to change to allow this? Earlier i tried also adding <Alias> in the server.xml of tomcat but to no avail and since removed it. Also if it means anything I have also left the web.server.host= in portal-ext.properties as blank.
Any help would be great. Thanks in advance.
--------------------------------------------------------------------------------------Found my solution.
Yes the virtual host needs to be left empty.
My culprit was the proxyName="" in the Connector segment of the server.xml.
Removed it and now it works...and of course with the trailing /web/guest/ ... oh well.
Donald Stephen, módosítva 4 év-val korábban

RE: Pros and cons of setting Virtual host in liferay

New Member Bejegyzés: 1 Csatlakozás dátuma: 2019.11.23. Legújabb bejegyzések
Achmed Tyrannus Albab:

David H Nebinger:

With VHosts, you're saying the site is externally known as liferaytest1.com, and no other url. So when you're on a site tied to liferaytest2.com and you pick a site for liferaytest1.com, well then your URL is going to change.

If you want both liferaytest1.com and liferaytest2.com to stick, remove the virtual host mappings and just let both names resolve to the same server. Liferay will not try to change the URLs, so if you come in via liferaytest2.com, then you'll stay there.

I am using liferay 7.1, my intention is almost if not the same.
I have www.abc.com/MyKFC and admin.abc.com , i want both to point to the same liferay. 
I have already disabled (by removing) the virtual host in CMS at Site>Configuration>Site Settings>General Tab>Removed earlier set url which was www.abc.com . Still if i go to admin.abc.com the url will change back to www.abc.com .

Is there anymore setting that i need to change to allow this? Earlier i tried also adding <Alias> in the server.xml of tomcat but to no avail and since removed it. Also if it means anything I have also left the web.server.host= in portal-ext.properties as blank.
Any help would be great. Thanks in advance.
--------------------------------------------------------------------------------------Found my solution.
Yes the virtual host needs to be left empty.
My culprit was the proxyName="" in the Connector segment of the server.xml.
Removed it and now it works...and of course with the trailing /web/guest/ ... oh well.

 You can always go to URL www.liferaytest1.com/web/liferaytest2site/page to get to Liferaytest2 site, but it is generally not recommended (you should use Virtual Host URLs and most Liferay-generated links will use them). If there is a problem that users have to log twice (for each domain separately), you should install some SSO solution like CAS, NTLM etc.