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.



2 comments:

  1. Hi, I'm failing miserably at getting a reverse proxy to work with 6.1. I'm already using the --proxy-mode option, but if I add a --port=XXXX I get a "error: no such option"...
    Thanks

    ReplyDelete
  2. Hello DReis,

    Sorry for late reply.

    I have just tested the same, I have created a proxy as shown above with version 6.1.

    I have just added the option --proxy-mode while running the server and I am able to use my web with my domain webclient.

    Hope this will help.

    Thanks.

    ReplyDelete