Help

2

Openerp 7 SSL redirect

Avatar
Prakash

OpenERP 7 Linux Server SSL Setup installed with the below steps given in the url:-

       http://www.teckzilla.net/blogs/item/108-openerp-ssl.html

Working SSL with below url:-

           https://portno:Ip-address/

Issues in the below url:-

           http://portno:Ip-address/

           Not redirect  http into https

How to auto redirect from http into https?

Added following lines to redirct [http into https] (outside of the <directory> config blocks) into the file /etc/apache2/sites-available/default

RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]

But the above code is not redirect http into https ?

How to redirect in openerp 7 in linux server?

Avatar
Discard
3 Answers
0
Avatar
Davide Corio
Best Answer

Try with:

<VirtualHost *:80>
  ServerName myservername
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>

If this won't work, Apache is probably ignoring the rule.

Also, replace * with your ip or server name if this is the case.

4 Comments
Avatar
Discard
Avatar
Prakash
-

Thanks for reply added the code /etc/apache2/httpd.conf 1) access url http://servername connection time out error but able to access in https://servername. and unable to redirect http://ipaddress

Avatar
Davide Corio
-

have you defined the <VirtualHost *:443> directive?

Avatar
Prakash
-

Yes Virtual Host defined in the path /etc/apache2/sites-avilable/openerp-ssl

Avatar
Davide Corio
-

i just noticed that you're typing http://ip:port and https://ip:port. you should just type http://ip and you should get redirected to https://ip. in order to avoid typing :port you need to properly configure a proxy directive

0
Avatar
timrea
Best Answer

Hi David, I don't quite get which one you meant would work. I'm on Apache2. Where is your config supposed to be? In Apache.conf or 'default' in sites-available or in '.htaccess' in var/www?

Please advice. Thank you. -Timrea.

Avatar
Discard
0
Avatar
Prakash
Best Answer

I followed the steps http://pastebin.com/uGVtBxQ3 but still SSL issues not solved.

Now I tried the below conf code:-

<VirtualHost *:443>
 ServerName openerp.servername.com
 SSLEngine On
 SSLCertificateFile /etc/apache2/ssl/server.crt
 SSLCertificateKeyFile /etc/apache2/ssl/server.key
 ProxyRequests Off
 <Proxy *>
 Order deny,allow
 Allow from all
 </Proxy>
 ProxyVia On
 ProxyPass / http://127.0.0.1:8069/
<location / >
 ProxyPassReverse /  
</location>
 RequestHeader set "X-Forwarded-Proto" "https"
#Fix IE problem (httpapache proxy dav error 408/409)
 SetEnv proxy-nokeepalive 1
</VirtualHost>

But issues is when typed https://openerp.servername.com/ in the browser then the output page open with http://openerp.servername.com/ instead of https.

[Redirect also applied in conf file but no changes]

Suppose i changed conf code

ProxyPass / http://127.0.0.1:8069/
     Changed into 
ProxyPass / http://127.0.0.1:80/

After that typed https://openerp.servername.com/ in the browser then the output page open with https://openerp.servername.com/ but show message It Works! but no content has been added, yet.

In OpenERP 6 version SSL Connection openerp-web.cfg has the following lines:

tools.proxy.on = True
tools.proxy.base = 'http://HOST.com/openerp'
tools.proxy.local = ''

But in OpenERP 7 version openerp-web.cfg file not available where to add the above line in openerp version 7?

Please give me solution how to solve this issue? Thanks

7 Comments
Avatar
Discard
Avatar
Davide Corio
-

the following is a working conf: http://pastebin.com/uGVtBxQ3

Avatar
Prakash
-

Hi Davide, for SSL setup openerp-server.conf file what are the extra lines are add? in both openerp-server.conf? or any one. Code Updated

Avatar
Davide Corio
-

OpenERP doesn't provide any SSL support, so you don't need to touch the config file.

Avatar
Prakash
-

Please see the updated code

Avatar
Davide Corio
-

look at the configuration i posted previously. you can use it "as is" by just changing the ip of your server.

Avatar
Prakash
-

Yes perviously posted also used changed ip address <VirtualHost *:80>

ServerName openerpserver RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

</VirtualHost>

<VirtualHost *:443> ServerName openerpserver

RewriteEngine on RewriteRule ^/(.*) http://192.168.xx.xx:8069/$1 [P] ProxyPassReverse / http://192.168.xx.xx:8069/

SSLEngine On SSLCertificateFile /etc/apache2/ssl/server.crt SSLCertificateKeyFile /etc/apache2/ssl/server.key

</VirtualHost> But facing the same issue https:// redirect into http://

Avatar
toot
-

Davide Corio You are my HERO! Your pastebin example on May 24 '13 was the answer I have spent many hours looking for. Lots of nginx setup routines...with Apache there's an assumption of knowledge...hard for those who don't know. Thanks Davide!