跳至內容
選單
此問題已被標幟
6 回覆
30503 瀏覽次數

Hello guys,

When I try to print some document the odoo tries to generate the PDF using the Wkhtmltopdf. But right after I get this error:

Mixed Content: The page at 'https://' was loaded over HTTPS, but requested an insecure resource 'http://'. This request has been blocked; the content must be served over HTTPS.

I've configure the nginx webserver to use SSL with Let's Encrypt certificate. Everything looks fine, until I get this request over http instead of https. Why this is happening? How should I fix this?

I have already tried to update the web.base.url to https:// instead of http:// and I've also created the paramenter web.base.url.freeze and assigned to True. But that did not fix this issue. I still get that request from http.

Thank you.

頭像
捨棄
最佳答案

Hi,

It may come up due to missing the following, you can check:

in your Nginx probably in /etc/nginx/sites-enabled/some_file , please check X-Forwarded headers are present as below

location / {
proxy_pass http://localhost:8069;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $host;
proxy_redirect off;
proxy_request_buffering off;
proxy_connect_timeout  36000s;
proxy_read_timeout  36000s;
proxy_send_timeout  36000s;
send_timeout  36000s;
client_max_body_size 10240m;
}

or in nginx conf, 
proxy_redirect http://yourdomainhere/ https://yourdomainhere/;

or in odoo conf,
proxy_mode = True

Restart nginx, restart odoo serivces and check hopefully it will work now.

You can also check Settings -> Technical -> System Parameters, and make sure your web.base.url contains https:// (some people also add web.base.url.freeze set to True

I hope it would help someone.

頭像
捨棄

This worked perfectly in my case, thank you very much Hamzah

Thank you so much i dont wich of these settings did the trick and at this point i dont care im tired and happy that it worked after trying on my own for 5 hours.

最佳答案

Adding the below line to my nginx config file fixed the issue:

add_header'Content-Security-Policy''upgrade-insecure-requests';
頭像
捨棄

did the job for me, thanks

作者 最佳答案

After all it looks like this solution worked:

I have already tried to update the web.base.url to https:// instead of http:// and I've also created the paramenter web.base.url.freeze and assigned to True. 

Thank you.

頭像
捨棄
最佳答案

for anyone facing the same issue, here the fix that Work!

Add this to the odoo nginx conf block inside server block

proxy_redirect http:// https://;

or you can put your domain in, for example in my case: proxy_redirect http://skyerp.net https://skyerp.net;

I tested and it worked perfectly, i tried many other method but only this thing work, you do not need to mess with other setting like web base url, upgrade insecure connection and many other thing that people suggest. 

頭像
捨棄
最佳答案

Gracias Hamza por tu ayuda! En mi caso la solución que funcionó fue agregar en nginx:

location / {
proxy_pass http://localhost:8069;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $host;
proxy_redirect off;
proxy_request_buffering off;
proxy_connect_timeout  36000s;
proxy_read_timeout  36000s;
proxy_send_timeout  36000s;
send_timeout  36000s;
client_max_body_size 10240m;
}
頭像
捨棄
最佳答案

Hello there, I am facing this problem as well when switching to non-english languages. 

Is it working by your solution?

頭像
捨棄
作者

Not sure, to be honest.

In the past I believe I was using a non-english language as well. So I believe it should work.

Right now both my Odoo solutions are managed by a service provider.

相關帖文 回覆 瀏覽次數 活動
3
6月 25
1749
0
3月 25
1844
1
3月 25
1953
2
7月 24
4467
1
5月 24
2903