Reputation: 38661
On my Ubuntu server, I have installed Odoo at http://localhost:8069; Odoo is a Python application, and serves through a Python server.
When http://localhost:8069 is opened first, Odoo checks for currently logged in user; if there is none, it redirects to http://localhost:8069/web/login ; if there is a logged in user, it redirects to http://localhost:8069/web.
I would thus like to make http://localhost:8069/web available on a subdomain, say http://odoo.myserver.com - so the user does not have to be distracted by the port (the :8069
part) and the subfolder (the /web
part). In other words, the user should get the login page as http://odoo.myserver.com/login (instead of http://localhost:8069/web/login).
In my case, http://odoo.myserver.com is on the same computer as the one serving Odoo. So, I thought I'd try a reverse proxy in Apache2 for this. This is my subdomain configuration as a virtual host:
<VirtualHost *:80>
ServerName odoo.myserver.com
ServerAdmin [email protected]
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
<Location />
ProxyPass http://127.0.0.1:8069/web/
ProxyPassReverse http://127.0.0.1:8069/web/
</Location>
ProxyErrorOverride off
</VirtualHost>
When I have this active, and load http://odoo.myserver.com in my browser for the first time, I am redirected to http://odoo.myserver.com/web/login, and I get an Odoo styled 404 "Page not found" page.
If I try without a Location tag, and I map /web
local to /web
remote:
<VirtualHost *:80>
ServerName odoo.myserver.com
ServerAdmin [email protected]
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /web/ http://127.0.0.1:8069/web/
ProxyPassReverse /web/ http://127.0.0.1:8069/web/
ProxyErrorOverride off
</VirtualHost>
... then http://odoo.myserver.com simply gives me the default Apache page, and http://odoo.myserver.com/web/ does redirect to http://odoo.myserver.com/web/login (and something similar happens when I map as ProxyPass(Reverse) / http://127.0.0.1:8069/web/
) - but this is not what I want.
EDIT: Closest I got to, was by following https://serverfault.com/questions/698995/apache-proxypass-redirect-subdomain-to-port-and-path :
<VirtualHost *:80>
ServerName odoo.myserver.com
ServerAdmin [email protected]
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8069/
ProxyPassReverse / http://127.0.0.1:8069/
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/web
RewriteRule ^/$ /web/$1 [R,L]
ProxyErrorOverride off
</VirtualHost>
... in which case, when I load http://odoo.myserver.com in my browser, I'm redirected to http://odoo.myserver.com/web/login, and I get a proper Odoo login page. Close enough, but still not there, because the /web
part is still visible.
So, how would it be possible to proxy in such a way, that when:
...?
Upvotes: 1
Views: 3638
Reputation: 2026
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName odoo.myserver.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location /login>
ProxyPass / http://127.0.0.1:8069/web/login
ProxyPassReverse / http://127.0.0.1:8069/web/login
</Location>
<Location />
ProxyPass / http://127.0.0.1:8069/web
ProxyPassReverse / http://127.0.0.1:8069/web
</Location>
</VirtualHost>
Try this config
Upvotes: 1