Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

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

Subscriure's

Get notified when there's activity on this post

This question has been flagged
apache2odooV8
12 Respostes
18729 Vistes
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
Descartar
Avatar
PY
Autor 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
Descartar
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
Descartar
PY
Autor

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
Autor

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

Ermin Trevisan

See my amended answer.

PY
Autor

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
Autor

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
Autor

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!

Registrar-se
Related Posts Respostes Vistes Activitat
Odoo on different URL Path
apache2 odooV8
Avatar
0
de maig 15
5476
Odoo Apache2 SSL connection Glitch
ssl apache2 odooV8
Avatar
Avatar
1
d’abr. 16
6164
CONFIGURACION DE CORREO PROPIO POR PRUMERA VEZ
odooV8
Avatar
0
de març 25
2015
How to remove model if not in the py files anymore
odooV8
Avatar
0
de gen. 25
4290
Start odoo server automatically in Ubuntu 14.04 on reboot Solved
odooV8
Avatar
Avatar
1
d’ag. 23
15927
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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