留言板

Pros and cons of setting Virtual host in liferay

Suyash Madhusudan Bhalekar,修改在10 年前。

Pros and cons of setting Virtual host in liferay

New Member 帖子: 24 加入日期: 12-9-4 最近的帖子
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,修改在9 年前。

RE: Pros and cons of setting Virtual host in liferay

Junior Member 帖子: 87 加入日期: 08-8-20 最近的帖子
same question (BUMP)
thumbnail
Krzysztof Gołębiowski,修改在9 年前。

RE: Pros and cons of setting Virtual host in liferay

Liferay Master 帖子: 549 加入日期: 11-6-25 最近的帖子
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,修改在9 年前。

RE: Pros and cons of setting Virtual host in liferay

Liferay Legend 帖子: 14916 加入日期: 06-9-2 最近的帖子
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,修改在4 年前。

RE: Pros and cons of setting Virtual host in liferay

Regular Member 帖子: 158 加入日期: 10-3-5 最近的帖子
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,修改在4 年前。

RE: Pros and cons of setting Virtual host in liferay

New Member 发布: 1 加入日期: 19-11-23 最近的帖子
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.