Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

3

Automatically choose database based on subdomain

By
Timo Goosen
on 11/24/14, 9:21 AM 1,862 views

I'm using Odoo + Nginx as a reverse SSL proxy. I followed this guide to get it setup:

http://www.schenkels.nl/2013/01/reverse-ssl-proxy-using-nginx-with-openerp-v7/

 

I'd like to type in somessubdomain.example.com and have it redirected to the login page for that given database.  In the background this should be happening:

When I request:

somessubdomain.example.com

This should be returned https://somessubdomain.example.com

And in the background I would like this to happen: 127.0.0.1:8069/web?db=somesubdomain

 

On OpenERP 7 + Apache2 I know how to set this up , but I'm not sure how to do this with Nginx.

 

Someone refered me this guide but is not helping much: https://www.odoo.com/forum/help-1/question/domain-based-db-filter-6583

 

Hope you understand my question.  Your help would be much appreciated.

3
P4
On 3/11/15, 5:05 PM

I think your problem is due to the following: with the most common nginx reverse proxy I've seen on the web, all https requests for subdomains are forwarded to the same server:

http://127.0.0.1:8069

or

http://localhost:8069

that is the domain that reaches dbfilter!!

The solution I found was:

  • Add dbfilter=%d to your config file. I have tried several other options like ^%d$, and this is the only one that worked!
  • restart odoo
  • Then, for each subdomain you want to add:
    • Configure your dns so that it points to the right ip
    • Add a line to /etc/hosts with
    • 127.0.0.1 subdomain.localhost
    • Create a new site in nginx with server_name subdomain.example.com that does a proxy_pass to http://subdomain.localhost:8069
    • restart nginx
    • create the database whose name is *exactly* subdomain

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/24/14, 9:21 AM
Seen: 1862 times
Last updated: 10/28/16, 4:43 AM