This question has been flagged
3 Replies
4095 Views

Hi,

I have got odoo13 community edition.
Single DB.
2 companies and 2 websites publicly accessible using Nginx reverse proxy. Each site has got public domain and DV wildcard SSL certificate installed and working correctly.
The first site is configured as site1.com and has no issues to respond if the request is to site1.com or www.site1.com.
The second site is configured as site2.com (no www.) and has no issues to respond to the request to site2.com, but if the request is www.site2.com it redirects the web user to site1.com!
By saying configured I mean Settings/Websites/Domain name = site1.com or site2.com
It works for site1.com - you can request site1.com or www.site1.com and the same website will open - website 1.
The same config for site2.com seems to work only if you request exactly what is written in the field of the domain name - site2.com. I had a play and amended the field from site2.com to www.site2.com. Yes, now you can open the website 2 only if you request www.site2.com. The site2.com will open website 1.
There is no option to put site2.com and www.site2.com, together in the same domain name field as all request will go to the website 1 only, i.e. website 2 cannot be reached.
Both domain DNS services are configured as follows:
site1.com -> a.a.a.a
www.site1.com is a cname to site1.com
site2.com ->a.a.a.a
www.site2.com is a cname to site2.com

As a result, the ping to each is leading to the same IP:
ping site1.com -> a.a.a.a
ping www.site1.com -> a.a.a.a
ping site2.com -> a.a.a.a
ping www.site2.com -> a.a.a.a

As expected the IP a.a.a.a is publicly accessible on port 80/443.

Nginx configuration for each block (virtual host) is identical and checked.

Do you know how can I let the web users go to the website 2 (site2.com) regardless of what they type - site2.com or www.site2.com?

Thank you in advance!

Avatar
Discard

I have same setting with 13CE. one database , two domains . domai1.com working fine domain2.com points to database selector.
How did you manage to get multi website/domain working ?

Author

Odoo v.13 and v.14 can handle the first domain domain1.com with both domain1.com and the subdomain www.domain1.com, without any issues. The second domain (and any other on top) may have only one pointer - domain2.com or www.domain2.com, but not both. The result is:
domain1.com - resolves and opens the expected page
www.domain1.com - resolves and opens the desired page
domain2.com - if set up - resolves and opens the desired page, but the subdomain www.doamin2.com doesn't work
www.domain2.com - if set up - resolves and opens the desired page, but the domain domain2.com doesn't work

The experience with domains 3, 4 and so on is the same as per domain2.com

I have not received any help or proper communication from Odoo support at that time. My conclusion is multidomain is initially designed to serve a single company like:
domain1.com - works fine
www.domain1.com - works fine
any other subdomain like www will work fine as:
eshop.domain1.com - it is like an additional domain, but you do not need www.eshop.domain1.com as only the subdomain main name is enough.
intranet.domain1.com

It is advertised as multidomain and multi-company and generally speaking is true, but you cannot add two independent websites and to expect to request the content via www or without it for both.

I didn't play with the latest version 15 yet. And I do not plan to do it in the scope of the webserver.
I spun a VM with WP for the regular websites, where I need www. and the main domain. The eshop subdomain only can live on the Odoo.

Back to the question of why you can see the database selector? The reason is you didn't hide it. If you do it the problematic record will open the webpage of your domain1.com.

Best Answer

Hi @Nanyo, i have an issue with multi website domains. So when i define my second domain it redirects back to db selector and not the website. how did you manage to configure the multiple domains please

Avatar
Discard
Author

Sorry, I didn't come here for a while. Please have a look at the answer I gave to zahid

Best Answer

 You can use a CNAME DNS entry to link the subdomain www to a domain, or you can use a permanent redirect (301) in your reverse proxy. With nginx such a redirect looks like this:

server { 
# Redirect non-www to www
server_name example.com;
return 301 $scheme://www.example.com$request_uri;

with Caddy Server such a redirect looks like this:

example.com {
    redir https://www.example.com{uri}
}

About which way is to prefer (especially from a SEO perspective), you may find many interesting readings in the internet. When using redirects, you avoid the problem of indexing of both domains by search engines.


Avatar
Discard
Author

Hi Ermin,

Thank you for your reply! If you read again the very first post you will see the CNAME DNS game has been played already. The reverse proxy at NGINX has been configured as you suggested before the first post. You are correct for the very first website in a multi-website configuration. The problem is with the second and next websites. The very first website works with the www subdomain and the domain only. Odoo interface will allow you to enter only one domain or subdomain (www), but not both. Apparently, it is not an issue for the first website. I decided I am not fluent and checked with two of the Gold partners. I have sent them the NGINX config and revealed the real domains so they checked the CNAME for both domains.

The only one solution is to have a "translator" before the reverse proxy and to convert the incoming request to the expected from Odoo (exactly what you put in the name of the domain at the Odoo interface). This translator can be anything, but the load balancer would do the job. I bet all customers at Odoo.com portal are welcomed by load balancers and they "translate" the request of www subdomain to the domain only.

I am happy to share in a personal message with you the DNS config and NGINX config. Also happy to jump into a screen sharing session with you. I appreciate you may know something that others and I do not.

I would be curious to test it with Odoo v15. I doubt it would be resolved as this is an isolated case and if you intend to have different domains it is highly likely to have load balancers with multiple apps and PostgreSQL boxes.

Using permanent redirects in the reverse proxy, you only send one hostname per domain to Odoo (either with or without www, upon your decision).

In my example Odoo will only receive requests for www.example.com, requests without www will be converted to www.example.com before it reaches Odoo.

To make it very clear: After the redirect, there is only one server_name (in nginx-language) left, you do not proxy both www and non-www domains afterwards.

Author Best Answer

I have tested the same case in Odoo v14. Same results. It is not an issue. It is by design. If you want to have multiple websites and to have their www subdomain and their domain (www.domain.com + domain.com) you need a load balancer(s), where you can describe the rules and push the "correct" request to Odoo's NGINX.
I will take it as resolved (in a hard way)!

Avatar
Discard

I can not see any relation to load balancers.