I'm using Apache to proxy all requests from my domain to my Odoo server.
Then to proxy all requests from my customers URLs to their respective databases (sub-domain of my domain).
Here's what my config looks like:
################
# 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 customer-domain.fr
ServerAlias www.customer-domain.fr
ProxyRequests Off
ProxyPass / http://customer-domain.mydomain.fr/
ProxyPassReverse / http://customer-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>
Now, when I go to customer-domain.fr
, after I click a few internal links, I'm redirected to customer-domain.fr, customer-domain.mydomain.fr
.
Which is weird, because it's as if Apache somehow appended the target URL at the end of the source url of the proxy. I tried with Chrome, Firefox, and someone else house.
What causes this coma to appear, and how to prevent this ?
Update
I commented out the <Proxy *>
section.
So, I did some tests with the console:
- clear cache
- go to customer-domain.fr -> no problem here, I receive a 200 response on the exact domain I requested.
click on English to change the language of the website : here are the headers :
**General** Request URL:http://customer-domain.fr/website/lang/en_US?r=%2Fen_US%2Fpage%2Fhomepage Request Method:GET Status Code:303 SEE OTHER Remote Address:01.23.45.67:80 **Response Headers** Connection:Keep-Alive Content-Encoding:gzip Content-Type:text/html; charset=utf-8 Date:Fri, 13 Jan 2017 13:53:21 GMT Keep-Alive:timeout=10, max=100 Location:http://customer-domain.fr, customer-domain.mydomain.fr/en_US/page/homepage Server:Werkzeug/0.8.3 Python/2.7.3 Set-Cookie:website_lang=en_US; Path=/ Set-Cookie:session_id=xxx; expires=Thu, 13-Apr-2017 13:53:21 GMT; Max-Age=7776000; Path=/ Transfer-Encoding:chunked Vary:Accept-Encoding Via:1.1 mydomain.fr Via:1.1 customer-domain.fr **Request Headers** Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Encoding:gzip, deflate, sdch Accept-Language:fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4 Cache-Control:no-cache Connection:keep-alive Cookie:website_lang=fr_FR; session_id=xxx Host:customer-domain.fr Pragma:no-cache Referer:http://customer-domain.fr/ Upgrade-Insecure-Requests:1 User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 **Query String Parameters** r:/en_US/page/homepage