Fórum

RE: Virtual Hosts and Portal Instances (www and no www)

Rice Owl, modificado 14 Anos atrás.

[SOLVED] Virtual Hosts and Portal Instances (www and no www)

Regular Member Postagens: 177 Data de Entrada: 24/04/09 Postagens Recentes
Hi all,

I did some poking around regarding an issue I've been having. I did see some other posts but didn't see any solutions that I could work with. Here is the issue:

I have a LifeRay install and using the default portal instance have it using domain "firstdomain.com". This works fine. www.firstdomain.com or firstdomain.com both work as expected.

I have another domain, seconddomain.com and created another portal instance on the same LifeRay installation. The problem seems to be if I type www.seconddomain.com, it actually takes me to firstdomain.com. If I type seconddomain.com (omitting the www), I am taken to the correct portal instance.

For a quick fix, what I did was create a community within the first portal instance that had a virtual host setting of www.seconddomain.com and then simply provided a hyperlink to seconddomain.com. But I'm wondering if there is a better way of doing this? It seems like subdomains (www in this case) aren't treated as I expected. I have LifeRay 5.2 + Tomcat 5.5 bundle running. What is the proper way to redirect the "www" subdomain of "seconddomain.com" to the right portal instance? Its not a DNS issue as WWW is pointed to the proper IP address. Any insights?

Another potential "fix" i just thought of, not sure if it will work, is to create a community w/in the second portal instance (hosting the seconddomain.com instance) and use a virtual host of www.seconddomain.com there instead of in the first instance. Not sure if this will work though. It may not.
Rice Owl, modificado 14 Anos atrás.

RE: Virtual Hosts and Portal Instances (www and no www)

Regular Member Postagens: 177 Data de Entrada: 24/04/09 Postagens Recentes
Okay problem solved. Basically I tried out the option I discussed. In the seconddomain.com portal instance, I edited the existing community and put in the virtual host "www.seconddomain.com" and removed the virtual host I had originally put in the first portal instance. It works now with and without the subdomain.
Dennis Nes, modificado 14 Anos atrás.

RE: Virtual Hosts and Portal Instances (www and no www)

Junior Member Postagens: 55 Data de Entrada: 23/09/09 Postagens Recentes
Hey Rice,

I am having exactly the same problem. But after changing the virtual host to www.seconddomain.com (Contol Panel - Settings - General, right?) I am being redirected to the firstdomain.com after typing in seconddomain.com. Do have have access to your DNS settings. Mine are as fallows:

*.seconddomain A [myip]
seconddomain A [myip]

Thanks
Rice Owl, modificado 14 Anos atrás.

RE: Virtual Hosts and Portal Instances (www and no www)

Regular Member Postagens: 177 Data de Entrada: 24/04/09 Postagens Recentes
Dennis, yeah sounds like you are having the exact same problems I was having. I think the whole issue had to do with subdomains and perhaps the app server (tomcat in my case) not doing it quite as expected. I had the exact same results - if I changed the virtual host to have a "www" in front of it for the seconddomain, then if a user didn't input the www, it'd go to firstdomain and if i left it out, then if someone typed www.seconddomain.com it went to first domain. I think it all has to do with handling of the subdomain "www" (or not, if you put it in the virtual host). I don't think it is a DNS setting issue, I have the same settings as you have. I think its b/c your hosting two domains on the same IP address and its Tomcat not handling it correctly. Are you using Tomcat+LifeRay? I bet if you put a reverse proxy in front, that may solve the issues. I think its Tomcat that is not handling it quite properly and not necessarily LifeRay.

So, although not perfect, the fix I suggested does work. For the virtual host of your second portal instance (assuming this is what you are doing), leave out the www and just put seconddomain.com. Then in the community in the 2nd portal instance (w/ the seconddomain.com), I put a virtual host in THAT community of www.seconddomain.com. This fixed the problem and I was able to do seconddomain.com and www.seconddomain.com and it both pointed to second domain. If you have multiple communities or organizations, you can probably take a similar approach still.

I'm not an expert in DNS and app servers, but from trying to remember the research I did in investigating this issue, it all had to do with resolving the "www" subdomain ONCE it hits the server. If you can hit your server using www with your second domain, it seems like then it is set up correctly. Its not really a DNS issue per se, its once the request gets to your server, how it handles that subdomain. And from the looks of it, by default, www defaults to your first portal instance, whatever that domain may be. I didn't do much beyond that, but I'm guessing if you used a reverse proxy or something like that (or even maybe JBoss or something a bit more flexible and powerful than Tomcat), you could probably fix the issue w/o having to worry about virtualizing the community.

Good luck and let me know if that made sense. Like I said, if you are interested in getting it fixed as is, I know it does work if you use a virtual host for the community. Another option besides the proxy server may be to soem virtual host configuration in Apache. Apache supports virtual hosts and you can do rewriting rules and such to get things to work.



Dennis Nes:
Hey Rice,

I am having exactly the same problem. But after changing the virtual host to www.seconddomain.com (Contol Panel - Settings - General, right?) I am being redirected to the firstdomain.com after typing in seconddomain.com. Do have have access to your DNS settings. Mine are as fallows:

*.seconddomain A [myip]
seconddomain A [myip]

Thanks
Dennis Nes, modificado 14 Anos atrás.

RE: Virtual Hosts and Portal Instances (www and no www)

Junior Member Postagens: 55 Data de Entrada: 23/09/09 Postagens Recentes
Thanks ver ymuch for your help. Now it is working for me too.

@LiferayDev: Maybe this process should be simplified a bit
Ronaldo Felipe, modificado 13 Anos atrás.

RE: Virtual Hosts and Portal Instances (www and no www)

New Member Postagens: 6 Data de Entrada: 24/08/10 Postagens Recentes
Dennis Nes:
@LiferayDev: Maybe this process should be simplified a bit


I agree. If I understood theses solutions, they'd be ways to make www.domain.com become domain.com or vice versa. Isn't there a way to be sure that it will be a portal singletone? (in my case the session that handles who is logged should be the same for www.domain.com and domain.com)


My problem is a little bit different, this guy explains better http://shchekoldin.com/2010/05/27/sharing-jsessionid-across-subdomains/ , but somehow his solution didn't work.
thumbnail
Liviu Cismaru, modificado 13 Anos atrás.

RE: Virtual Hosts and Portal Instances (www and no www)

New Member Postagens: 14 Data de Entrada: 10/09/08 Postagens Recentes
The way we handle this on our domain (accentway.com / www.accentway.com ) is by using the URL forwarding feature on our provider's site.

i.e.
accentway.com ( @ ) is A (Address) ;
www.accentway.com (www) is URL Frame (in other words URL forwarded with masking) to accentway.com.

Side note - It takes 30 secs to do this.

Hope this helps.
thumbnail
Trí Đức Võ, modificado 12 Anos atrás.

RE: Virtual Hosts and Portal Instances (www and no www)

Junior Member Postagens: 31 Data de Entrada: 09/06/05 Postagens Recentes
Dear All
We discuss here : http://www.vssic.com/web/guest/forum/-/message_boards/message/32632
When we create SITE and assigned to URL , type www for the 2nd Portal Instance, then browser display no-www screen with a error ( not found resource because www 2nd Portal Instance has no PAGE - if SITE has PAGE browser will show its content without error).
And we found that can deface another Domain by used SITE virtualization if you don't manage virtual host carrefully ( unique www and no-www domain name).