The first two vhosts works as expected. The second one proxy a Odoo server. I would like to make another proxy from my secondary domain to my Odoo server. However, Odoo must receive the subdomain matching the database, else it won't serve it.
Here's my code for now:
# static homepage
<VirtualHost *:80>
ServerName mydomain.fr
ServerAlias www.mydomain.fr
DocumentRoot /var/www/odoo
</VirtualHost>
# 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>
# a secondary domain
# should point to a specific database
<VirtualHost *:80>
ServerName www.secondary-domain.com
ServerAlias secondary-domain.com
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://some_database.mydomain.fr
ProxyPassReverse / http://some_database.mydomain.fr
ProxyVia On
</VirtualHost>
################
# restrictions #
################
<Location /web/database>
Order deny,allow
Deny from all
Allow from x.x.x.x
</Location>
I'm not really into server management, so I don't know much (even after reading the docs).
Forgot to mention what I get in response:
secondary-domain.com
gives me a 502 Proxy Errorsome_database.mydomain.fr
works as expected
If I put the third <VirtualHost/>
bloc in second position, the whole site mydomain.fr lags and that does not solve the 502 Proxy Error for my secondary domain.
If I quote the ProxyPreserveHost
directive, going to secondary-domain.com
leads to secondary-domain.com, some_database.mydomain.fr
... What is happening here ?
I need confirmation that this can be done and that my setup is doing that:
- User asks for
secondary-domain.com
- Third vhost entry proxies the request to
some_database.mydomain.fr
- Second vhost entry proxies the request to
mydomain.fr:8069