This question has been flagged
5 Replies
14378 Views

Hello, I have a question, I hope you can help me:

If I want to filter the DB by subdomain, ie: pharmacy.sample.com (select the DB "pharmacy"), cellar.sample.com (select the DB "cellar"), shoe.sample.com (select the DB "shoe").

I use the following: --db-filter=^%d$ And it works great!

But if I require filter the DB by domain, ie: erp.pharmacy.com (select the DB "pharmacy"), erp.cellar.com (select the DB "cellar"), erp.shoe.com (select the DB "shoe").

So what I should put in "--db-filter"?

Reference: help.openerp.com/question/6583/domain-based-db-filter/

Of course, thank you very much for your help and cooperation!

Avatar
Discard
Best Answer

Hi all,

we find a solution for use %h and subdomain, create your db in replace '.' by '-'.

Example : for the domaine erp.pharmacy.com, create db erp-pharmacy-com

And in your file .conf, at line dbfilter, write this : dbfilter = %h

Works for Odoo v8

Avatar
Discard
Best Answer

I had a similar problem. It is not possible with Odoo to filter db's on anything other than the subdomain or, if the subdomain is 'www', the domain. I wanted to map company domains to different dbs, like this:

http://accounts.company1.com => db = company1

http://accounts.company2.com => db = company2

To fix this, I had to modify the function db_filter in http.py:

if d == "www" and r:

becomes:

if (d == "www" or d == "accounts") and r:


You can have different prefixes you want.

Avatar
Discard
Best Answer

Houssine,

I tried using your suggestion of --db-filter=^%h$, but it did not work. From my understanding %h would be "sub.domain.com". I tried creating a database that was  called "domain" and it did not work, so I tried creating "sub.domain.com", but it said that was invalid, so I tried "subdomaincom" and that still did not work, any ideas? (Odoo V8)

UPDATE: I believe this is not possible using only Odoo, I believe you have to use a 3rd party application like Apache or NGINX.

I found this guide for Reverse SSL Proxy with NGINX: http://www.schenkels.nl/2013/01/reverse-ssl-proxy-using-nginx-with-openerp-v7/

Anyone have any documentation relating directly to routing domains? Thanks!

Avatar
Discard
Best Answer

You should select --db-filter=^%h$

Avatar
Discard