跳至内容
菜单
此问题已终结
4 回复
37065 查看

Hi,

Please, Is there a way to get configure https for Odoo.

for example:

instead of using the syntax: http: // server-IP: 8069, I use https: // server-IP: 8069

Thanks.

形象
丢弃

Thank you @zbik for your help

最佳答案

Example apache configuration:

<VirtualHost your.domain:443>
ServerName your.domain
SSLProxyEngine on
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/your.domain.crt
SSLCertificateKeyFile /etc/apache2/ssl/your.domain.key
SSLCACertificateFile /etc/apache2/ssl/your.domain.crt
RequestHeader set "X-Forwarded-Proto" "https"
SetEnv proxy-nokeepalive 1
ProxyPass / http://127.0.0.1:8069/
ProxyPassReverse / http://127.0.0.1:8069/
ProxyErrorOverride off
#TransferLog /var/log/apache2/transfer.your.domain.log
#Fix IE problem (httpapache proxy dav error 408/409)
SetEnv proxy-nokeepalive 1
</VirtualHost>




形象
丢弃

Thank you its fixed login redirect to http problem. Also enabled headers module of Apache with command "a2enmod headers".

RequestHeader set "X-Forwarded-Proto" "https"

I tried the same configuration file you wrote here with my odoo service but when I check with:
"curl -ILk http://<my_ip>:<my_port>"
it still goes to location:
"http://<my_ip>:<port>/web/login"
instead of
"https://<my_ip>:<port>/web/login"

Can you please help me, what can be the issues

I also tried with this documentation here: https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-in-ubuntu-20-04#step-4-redirecting-http-to-https

then actually it works very well and perfect if I check it like
"curl -ILk http://<my_ip>:80" it goes to Location: https://<my_ip>/

But again the problem is, this same thing doesnt work with odoo service's xmlrpc_port

最佳答案

You will have to generate your own SSL certificate or buy one.

You will get/receive two files, a *.pem and a private one *.key. Move the files to locations bellow.

For NGINX:

Add these lines in your server section:

server {
listen 443;
ssl on;
ssl_certificate /etc/ssl/certs/your.pem;
ssl_certificate_key /etc/ssl/private/your.private.key;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;

...

}

If you really want to listen on 8069, change above 443 to 8069.

形象
丢弃
编写者

Thank you @Carlos

can u give details step by step for http to https

最佳答案

I'm getting an error message for 

RequestHeader
形象
丢弃
最佳答案

you could use certbot by EFF. they will easily generate the SSL certificate for you so that you dont have to worry anymore.

形象
丢弃