Fóruns

Início » Liferay Portal » English » 2. Using Liferay » General

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Rice Owl
[SOLVED] Virtual Hosts and Portal Instances (www and no www)
16 de Junho de 2009 14:07
Resposta

Rice Owl

Ranking: Regular Member

Mensagens: 177

Data de entrada: 23 de Abril de 2009

Mensagens 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
RE: Virtual Hosts and Portal Instances (www and no www)
16 de Junho de 2009 14:07
Resposta

Rice Owl

Ranking: Regular Member

Mensagens: 177

Data de entrada: 23 de Abril de 2009

Mensagens 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
RE: Virtual Hosts and Portal Instances (www and no www)
14 de Dezembro de 2009 09:23
Resposta

Dennis Nes

Ranking: Junior Member

Mensagens: 55

Data de entrada: 23 de Setembro de 2009

Mensagens 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
seconddomain A

Thanks
Rice Owl
RE: Virtual Hosts and Portal Instances (www and no www)
14 de Dezembro de 2009 18:06
Resposta

Rice Owl

Ranking: Regular Member

Mensagens: 177

Data de entrada: 23 de Abril de 2009

Mensagens 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
seconddomain A

Thanks
Dennis Nes
RE: Virtual Hosts and Portal Instances (www and no www)
15 de Dezembro de 2009 03:28
Resposta

Dennis Nes

Ranking: Junior Member

Mensagens: 55

Data de entrada: 23 de Setembro de 2009

Mensagens 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
RE: Virtual Hosts and Portal Instances (www and no www)
10 de Setembro de 2010 10:16
Resposta

Ronaldo Felipe

Ranking: New Member

Mensagens: 6

Data de entrada: 24 de Agosto de 2010

Mensagens 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.
Liviu Cismaru
RE: Virtual Hosts and Portal Instances (www and no www)
15 de Outubro de 2010 03:22
Resposta

Liviu Cismaru

Ranking: New Member

Mensagens: 14

Data de entrada: 10 de Setembro de 2008

Mensagens 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.
Tri www.VSSIC.com
RE: Virtual Hosts and Portal Instances (www and no www)
11 de Março de 2012 10:34
Resposta

Tri www.VSSIC.com

Ranking: Junior Member

Mensagens: 31

Data de entrada: 8 de Junho de 2005

Mensagens 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).