Monday, 20 February 2012

OpenERP Webclient with Apache Reverse proxy

Follow the below steps.

First create a file in sites-available(without any extension) or add your configuration inside default file of apache2 inside /etc/apache2/sites-available.

add the following proxy configuration over there

For HTTP
<VirtualHost *:80>
        ServerName webclient
        ServerAdmin webmaster@localhost

         <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>
        ProxyRequests Off
        ProxyPass / http://localhost:8090/
        ProxyPassReverse / http://localhost:8090/

    # Fix IE problem (http error 408/409)
    SetEnv proxy-nokeepalive 1
        ErrorLog /var/log/apache2/webclient-error.log
        CustomLog /var/log/apache2/webclient-access.log combined
</VirtualHost>

For HTTPS
<VirtualHost *:443>


<Proxy "*">
    AddDefaultCharset off
    order deny,allow
    allow from all
</Proxy>
ProxyRequests Off
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
RequestHeader set "X-Forwarded-Proto" "https"
# Fix IE problem (http error 408/409)
SetEnv proxy-nokeepalive 1

</VirtualHost>

This file should already contain the lines:
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key





Now run this command.

sudo a2ensite filename (To enable this file in sites-enabled) or if you have added in existing file than there is no need to enable this file as it is already enabled.

now restart the apache2 services.

sudo service apache2 restart

Now to run this proxy with 6.0 change the cfg file.

tools.proxy.on = True
tools.proxy.base = 'http://webclient'


Now go to /etc/hosts and add your domain over there

127.0.0.1    webclient (here "webclient" is the domain for localhost 127.0.0.1)

now when you run 6.0 web-client with URL webclient it will work

For 6.1/7.0

Just you have to run server with --proxy-mode, there no other configuration at OpenERP side for version 6.1 or 7.0.