Skip to Content
Menu
This question has been flagged

Hi Everyone,


JD here, I'm a noob to odoo and I am evaluating the community edition for use with a few clients this year. It is a great platform and am looking forward to developing on it! Right now I am evaluating its limitations on multisite installations and ran into an issue I hope someone can help with quickly!


I saw the multisite feature was rather new and all seems well done on the backend but I am having a little bit of trouble on the frontend. 


The Problem:

domain1 shows website1 (all works as expected for domain1)

domain2 shows website1 when user is not logged in on domain2

domain2 shows website2 when user is logged in on domain2


When navigating the websites as an admin, the correct site and domain is shown when using the website switcher. If you manually enter the domain it will show you the correct website if the user is logged in. This is the behavior that makes me suspect that there is an odoo config I am missing. 

However, it may very well be that the issue has to do with my apache config rather than odoo but I thought if I missed something glaringly obvious someone may notice quickly and lend a hand!


The Setup:

The stack is running through Bitnami GCloud instance. 

I setup two companies each with its own website on its own domain. Each site has a homepage "/", a  custom page unique to each website, and a shared contact page.


 To manage the multiple domains through apache I 

  • Added VirtualHost (for ports 80 and 443) server and alias blocks to the recommended vhosts file for each of the domains

  • Setup the corresponding SSL certificates per domain via let's encrypt

  • Added an A record pointing both domains to the odoo instance IPv4. 

  • TESTED rerouting www to non and vice versa via apache and did not see a change in behavior

  • TESTED adding an X-ODOO_DBFILTER header with no change (expected behavior since only one db is present)

  • TESTED forwarding "fw=2" query string along with the response headers through apache rewrite to see if it forced selection of the data-website-id="2" ; result was that in the Network record I saw that the fw=2 was forwarded to fw=1 which I am unsure as to why and renders the incorrect website.


In the backend of oDoo I :

  • Added the domains to the website config and the language preference.

  • Assigned separate companies to each website

  • TESTED setting up users restricted to each domain and they worked as expected even though the incorrect website view was shown. ie. if User1 has access to Website1 on Domain1 then he could enter, if he had access to Domain2 only then the login on Domain1 did not work. 

  • TESTED: adding the https:// prefix and www. prefix to both and to only one or the other. no change in behavior on the frontend, still showed website1

  • I am not planning on using nor did I test the GeoIp for determining site selection.

When in inspecting the network requests for domain1 and domain2 I see that both pages first document request forwards on a query string of "fw=1" which appears to allow for site selection via a parameter as a backup to the identification of the domain through the request headers. Am I correct here?


On the frontend, when the user is not logged in I see that the fw=1 is always requested with the index of either domain. If  we use the "?fw=2" parameter on domain1 it will show website2 as expected if the user is logged in, but if he is not then the request is forwarded to "?fw=1".

In the HTML page source the html attribute contains the property data-website-id="1" regardless of the the domain the user visits when he is NOT logged in, however when an authorized user is logged in the html element shows  data-website-id="2" and displays website2 as expected.

It appears that I should be able to control which website view is rendered by passing a website-id along with the server request but outside of the "?fw=" parameter I a not sure how to do that.


Any help would be greatly appreciated and i hope everyone has a safe new year!
JD

Avatar
Discard

I have the same problem : one database, multicompany, two domaines
nothing i tried worked.
Does someone figured it out yet ?

Best Answer

Hello did you solve this problem?

Avatar
Discard
Best Answer

check ur nginx to set this header :

proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;

Avatar
Discard
Related Posts Replies Views Activity
1
Dec 24
56
2
Nov 24
597
1
Oct 24
257
1
Jul 24
425
1
Oct 24
1277