Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

[Odoo 8.0 - apache2] How to configure a proxy from an url to a specific database, in a multi-database setup ?

Naroči se

Get notified when there's activity on this post

This question has been flagged
apache2odooV8
12 Odgovori
18728 Prikazi
Avatar
PY

Hi !


Given the standard multi-db configuration:

# wildcard proxy for odoo:
# one subdomain -> one database

<VirtualHost *:80>
 ServerName mydomain.fr
 ServerAlias *.mydomain.fr

 ErrorLog /var/log/odoo/odoo-error.log
 CustomLog /var/log/odoo/odoo-access.log combined
 LogLevel warn

 <Proxy *>
  Order deny,allow
  Allow from all
 </Proxy>

 ProxyRequests Off
 ProxyPass / http://mydomain.fr:8089/
 ProxyPassReverse / http://mydomain.fr:8089/

 ProxyVia On
</VirtualHost>

So I already know how to serve database 'foo' with url http://foo.mydomain.com.

In my Odoo config, the dbfilter is set to ^%d$.

How one would add a domain which point to a specific database ?

Example:

  • user access to http://bar.com/web/login

  • apache proxies to http://quz.mydomain.fr/web/login

  • then the config already in place do its job like for other databases: proxy to http://mydomain.fr:8089/ with previous url given to Odoo, so that it serves the db matching the subdomain (here database_of_another_domain)

0
Avatar
Opusti
Avatar
PY
Avtor Best Answer

Finally, I came up with this:

################
# welcome page #
################

<VirtualHost *:80>
    ServerName mydomain.fr
    ServerAlias www.mydomain.fr
    DocumentRoot /var/www/odoo
</VirtualHost>


#################
# wilcard proxy #
#################

<VirtualHost *:80>
    ServerName mydomain.fr
    ServerAlias *.mydomain.fr

    ErrorLog /var/log/odoo/odoo-error.log
    CustomLog /var/log/odoo/odoo-access.log combined
    LogLevel warn

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyRequests Off
    ProxyPreserveHost On
    ProxyPass / http://mydomain.fr:8089/
    ProxyPassReverse / http://mydomain.fr:8089/

    ProxyVia On
</VirtualHost>


##################
# customer proxy #
##################

<VirtualHost *:80>
    ServerName other-domain.com
    ServerAlias www.other-domain.com

    ProxyRequests Off
    ProxyPass / http://other-domain.mydomain.fr/
    ProxyPassReverse / http://other-domain.mydomain.fr/

    ProxyVia On
</VirtualHost>


################
# restrictions #
################

<Location /web/database>
    Order deny,allow
    Deny from all
    Allow from 1.2.3.4
    Allow from 5.6.7.8
</Location>

Thanks to you, Ermin Travisan for your help.

0
Avatar
Opusti
Avatar
Ermin Trevisan
Best Answer

1. Use the dbfilter parameter in the openerp-server.conf file. You have 2 options:

- %d: Odoo extracts the subdomain of a hostname except of "www". Examples: "www.subdomain.domain.tld" results in the database name "subdomain". "subdomain.domain.tld" results i the same database name "subdomain". "www.domain.tld" results in the database name "domain"!

- %h: Odoo takes the FQDN. Examples: "www.subdomain.domain.tld" results in the database name "www-subdomain-domain-tld". "subdomain.domain.tld" results in "subdomain-domain-tld" and so on.

%d or %h are regex expressions, in my setup I use dbfilter = ^%d$.

2. In your Apache vhost definition proxy to the IP address and port of your Odoo server and forward the request headers:

You can either use the directive "ProxyReserveHost" or the options X-Forwarded-For (see http://stackoverflow.com/questions/6070335/retain-original-request-url-on-mod-proxy-redirect)  

If it is not possible to match database names from the host/domain name, you can use the module https://www.odoo.com/apps/modules/9.0/dbfilter_from_header/


2
Avatar
Opusti
PY
Avtor

I already know about the dbfilter, and all that works perfectly.

What I miss, is how to proxy from "bar.com/web" to "quz.mydomain.fr/web", so that "quz.mydomain.fr/web" gets in turn proxied to "mydomain.fr:8069/web" by the already in place configuration.

Ermin Trevisan

What is the name of the database you want to connect to? Is it "bar" or "quz"? I'm not sure if it has to be that complicated. Anyway, with a proper rewrite you should be able to achieve your goal.

PY
Avtor

The database is "quz", and "bar.com" is the domain that should be visible.

Ermin Trevisan

See my amended answer.

PY
Avtor

So, it isn't possible, on a single Odoo (8.0 by the way, forgot to mention) instance, to :

- proxy "foo.mydomain.fr", "xyz.mydomain.fr" to "mydomain.fr:8069" with respectively databses "foo" and "xyz" ;

- proxy "bar.com" to "mydomain.fr:8069" with database "quz" (can be anything, really) with or without the intermediate proxy "quz.mydomain.fr"

?

Ermin Trevisan

The first one is for sure easily possible, because that's the common dbfilter use case. The second one might be possible with proper URL rewriting. But I do not understand why you don't want to name the database "bar" instead of "quz" in the first place.

PY
Avtor

It's just an example. In fact it is the same. But since the config file allow only one dbfilter, it doesn't really matter.

Or does it ? Can a dbfilter have an OR condition ? Like: ^%d$ | ^%h$

Ermin Trevisan

No

Ermin Trevisan

The result of the dbfilter operation should match a single database which would not be the case in your example.

PY
Avtor

Thanks for your help. I'll try some rewrite rules and all that good stuff then.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Odoo on different URL Path
apache2 odooV8
Avatar
0
maj 15
5476
Odoo Apache2 SSL connection Glitch
ssl apache2 odooV8
Avatar
Avatar
1
apr. 16
6164
CONFIGURACION DE CORREO PROPIO POR PRUMERA VEZ
odooV8
Avatar
0
mar. 25
2014
How to remove model if not in the py files anymore
odooV8
Avatar
0
jan. 25
4288
Start odoo server automatically in Ubuntu 14.04 on reboot Solved
odooV8
Avatar
Avatar
1
avg. 23
15927
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now