Website not selectable at more than one databases #1401 Odoo
5 March, 2021 by
Website not selectable at more than one databases #1401 Odoo
Administrator
| No comments yet


I have installed two databases (company1 and company2) at my local odoo installation and at both the module website is installed. When calling the url “localhost:8069” always the last website, at which I was logged in last, is shown. It is not possible to call a specific website. I tried to select the database in the url (for example “http://localhost:8069/?db=company2”) but this also doesn’t works.

How is it possible to call a specific website with a url? Can you please implement the db-filter for the website module, that “http://localhost:8069/?db=company2” starts the website from the database company2?

I had a similar problem: multiple databases (with installed websites) on the same host and sharing the same Odoo installation. I solved installing the ‘dbfilter_from_header’ module.
This module catchs an header (HTTP_X_ODOO_DBFILTER) and uses its value as db-filter.

In my scenario I configured Apache (but you can use any other webservice) to create two virtual domains associated to the same host (http://localhost:8069/) and for each of those domains I defined an ‘X_ODOO_DBFILTER’ header giving it the DB-name that I wanted link to the specific subdomain.

Supposing that you use Apache, you should edit the file /etc/httpd/conf/httpd.conf typing something similar:


ServerName first.localhost
ProxyPass / http://localhost:8069/
Header add X-ODOO_DBFILTER “company1”
RequestHeader add X-ODOO_DBFILTER “company1”


ServerName second.localhost
ProxyPass / http://localhost:8069/
Header add X-ODOO_DBFILTER “company2”
RequestHeader add X-ODOO_DBFILTER “company2”

The result is that:

If you type ‘first.localhost’ in your browser, you’ll see the website related to the DB ‘company1’;
If you type ‘second.localhost’, you’ll see the website related to the DB ‘company2’;

thanks for your information. Is this also working with physical domains, not only with virtual domains? I have two companies installed at one odoo installation. And each company has their own domain (www.company1.com for DB “company1” and www.company2.com for DB “company2”). My idea is to use the domain www.company1.com for the website-module of DB “company1”, www.company2.com for the website-module of DB “company2” aso.

The other way to change the current database without use the dbfilter_header module is to access the url /web/database/selector
Eg. http://localhost:8069/web/database/selector

Sign in to leave a comment