Issue Details (XML | Word | Printable)

Key: LEP-6976
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Raymond Auge
Reporter: Mauro Mariuzzo
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Old Liferay Portal (Use Liferay Portal Standard Edition)

VirtualHost don't work with multiple community

Created: 01/Aug/08 02:07 PM   Updated: 30/Oct/08 03:22 PM
Component/s: None
Affects Version/s: 4.4.2, 5.1.0
Fix Version/s: 5.2.0

Time Tracking:
Not Specified

Environment: Linux and Windows


 Description  « Hide
I've setup a Liferay serving the DNS entry "www.pjoon.com".
I've created two community ("one" and "two" and associated public pages to "virt_one.pjoon.com" and "virt_two.pjoon.com".

Pointing my browser to "http://virt_one.pjoon.com" I can see then one pages.

The page contains a link to an item to the portal home page. When I click on this link my browser show the correct information but the host part of the URL remain "http:/virt_one.pjoon.com" instead of "http://www.pjoon.com".

If I log into "http://www.pjoon.com" and point my browser to a page of community one I loose my ticket. I need to login again

 All   Comments   Work Log   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
Mauro Mariuzzo added a comment - 25/Sep/08 07:22 AM - Visible to
I've talked about this issue with Brian Chan at Frankfurt.

He asked me to assign this issue to him, but I don't know how to do it.

Raymond, could you do that?

Raymond Auge added a comment - 25/Sep/08 07:49 AM - Visible to
Mauro, can you try this committed fix?

It should be simple to backport as the only change is in one method.

(See commit log.)

Raymond Auge added a comment - 25/Sep/08 09:11 AM - Visible to
Lastly, about the login issue across domains.

We can only provide a workaround for Tomcat. The reason being that session cookies are supposed to be domain specific.

In order to remain logged in across many domains, you must:

1) use tomcat
2) edit server.xml and change:

<Service name="Catalina">

TO

<Service name="Catalina" className="com.liferay.support.tomcat.core.PortalStandardService">

Once you do that, and also integrate the change from this ticket, both the domain issue and the login issue should be resolved.

Mauro Mariuzzo added a comment - 25/Sep/08 10:27 AM - Visible to
Hi Raymond,

I've backported the commited fix to Liferay 5.1.1 standard sources and IT WORKS! All the places where the URL was not changed now works great!

I'm already using tomcat, I'm using Liferay 5.1.1 for Java 5 bundled with Tomcat 5.5, so I've tried the second fix but it not work.

Mauro Mariuzzo added a comment - 26/Sep/08 10:24 AM - Visible to
I've looked into support-tomcat sources.

This package create a cookie for every 2 level (virtual) domain.

So "www.pjoon.com" (main portal) and "www.soccer.pjoon.com" (virtualhost for soccer community) use the same ".pjoon.com" cookie.

But, "www.pjoon.com" (main portal) and "www.tennis.com" (virtualhost for tennis community) use 2 different cookies.

In "portal.properties" there are a parameter to set the cookie domain; why don't use it into "support-tomcat" too?

Raymond Auge added a comment - 26/Sep/08 10:31 AM
I suspect that the browser will reject cookies which come from a completely different domain.

Raymond Auge added a comment - 26/Sep/08 10:33 AM
Can you test this and see if it works for our supported browsers?

Josh Asbury added a comment - 15/Oct/08 08:55 AM - Visible to
Guys -

What was the fix for this issue? I don't see it in the commit log.

Thanks,
Josh

Mauro Mariuzzo added a comment - 15/Oct/08 09:09 AM
The fix is included into Liferay 5.1.2 release.

Josh Asbury added a comment - 15/Oct/08 10:04 AM - Visible to
That's what I was afraid of. I am still having an issue. Let's say my base domain is abc.com with a community called xyz.com. I login to abc.com and switch to xyz.com from "My Places" -- losing my session in the process. What's worse is that when users login from xyz.com and switch to "My Community", they are now associated with abc.com (and subsequently losing their session).

I am using the Tomcat 5.5. bundle of 5.1.2. I switched the Catalina service to PortalStandardService as Ray suggested. Does anything need to be done with the portal-ext.properties?

Raymond Auge added a comment - 15/Oct/08 10:32 AM - Visible to
You CANNOT get around cookies being lost across second level domains...

You will ALWAYS lose your session going from:

abc.com -> xyz.com

This is in fact part of the HTTP spec and every browser in the world will enforce this to be true.

The best we can provide a solution for, which is a customization for tomcat alone, is to make it work across third level domains.

company instance = mydomain.ltd

community A = cool.mydomain.ltd

community B = cooler.mydomain.ltd


The only way to handle second level domains is to use a single sign on approach that works across domains, like Open ID, or others of it's ilk.

Josh Asbury added a comment - 15/Oct/08 10:39 AM
I understand that. What I would like to see is that the domain at which a person signed on at be maintained. Things worked this way prior to 5.1.2. For example, I sign at abc.com and switch to my public community -- the domain should still be abc.com. And the converse should be true as well -- if I sign on at xyz.com and switch to my community, the domain should still be xyz.com. What is happening for me at 5.1.2 is users are signing on at xyz.com, switching to their public page, and the domain switches to abc.com.

Raymond Auge added a comment - 15/Oct/08 11:00 AM - Visible to
Ok... we just implemented the revers as a feature because it was requested.

I suppose we will have to parameterize the behavior, so that you can set the behavior you want... keep domain across VHosts when signed in, or NOT.

It seemed more reasonable to inherit the domain when navigating to another VHost. Especially when you are implementing ASP type services.

Josh Asbury added a comment - 15/Oct/08 11:10 AM - Visible to
That seems reasonable except for when people are moving to their public communities. It would be good to somehow set 2 cookies at login -- one for the domain at which they logged in and one for the primary domain. I realize that's fantasy land, but it seems like that would be the best of both worlds.

Raymond Auge added a comment - 15/Oct/08 11:23 AM - Visible to
Actually, you have point, and it makes me think of another case... the new Control Panel community will be in the same boat...

Ok, so I'll have to address at least those two cases, even if we introduce the parameterization I just mentioned.

Thanks Josh!

I'll fix this as soon as I get a chance.

Josh Asbury added a comment - 15/Oct/08 11:33 AM - Visible to
Ahhh....I didn't think about the Control Panel community. You're right. That's an issue.

So, what do I need to change to revert this back to the functionality in 5.1.1? This didn't come up in my testing, and users are negatively impacted.

Raymond Auge added a comment - 15/Oct/08 11:49 AM - Visible to
Look at PortalImpl.java

~line 1118, comment out the "else" block...

Josh Asbury added a comment - 15/Oct/08 12:21 PM
Thanks, Ray. That did the trick.

Raymond Auge added a comment - 28/Oct/08 09:15 PM - Visible to
Adding the logic for navigating to and within the Users community to retain the domain name of the current virtual host.

Thus they won't lose their session.

Raymond Auge added a comment - 28/Oct/08 09:38 PM
Committed revision 22118.

Josh Asbury added a comment - 29/Oct/08 10:37 AM
Thanks, Ray!

Mauro Mariuzzo added a comment - 29/Oct/08 11:34 AM - Visible to
Ray,

can this new functionality (Adding the logic for navigating to and within the Users community to retain the domain name of the current virtual host.) be an optional?

In a Social Network context "Users" are owner by the "Social Network Enterprise" so the Users community must have Enterprise virtual host, not current community virtual host.


P.S.: It's correct, in the new code, to compare layout.getGroup().getClassPK() to themeDisplay.getUserId() without check group.getClassNameId()?

Raymond Auge added a comment - 29/Oct/08 01:05 PM - Visible to
The thing is Mauro is that Out of the box, user communities cannot be assigned a virtual host. It is a customization that you are able to assign them a virtual host. So, we would first need to make that an out of the box operation before making this check aware of that virtual hostname.

Yes it is safe to check

layout.getGroup().getClassPK() to themeDisplay.getUserId()

without checking classNameId. Because we use a single sequence for all pKeys meaning that even if classPK is from Group or Org, or User, they will bever collide.

Raymond Auge added a comment - 29/Oct/08 01:06 PM
It should be a pretty simple modification to check both for the user community and then also if it has a virtual host.

Mauro Mariuzzo added a comment - 29/Oct/08 01:38 PM - Visible to
Apologize my bad English.

I mean that a Community or an Organization can have a virtual host.

Enterprise have a virtual host.

User can't.

An Enterprise have multiple Community or Organization. Some with virtual host and some not.

This is how Liferay work out-of-box.

If a user is member of community soccer (with virtual host) and member of community tennis (without virtual host) the host part of the url is different if he return to his personal pages from soccer or from tennis.

I think this is a bug.

Mauro Mariuzzo added a comment - 29/Oct/08 01:44 PM - Visible to
Sorry Ray,

I need to go sleep!

I've re-read your code and understood that you have made the right things.

Apologize me!