Skip to Content
Menu
This question has been flagged
6 Replies
30322 Views

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.

Avatar
Discard
Best Answer

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.

Avatar
Discard

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.

Best Answer

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

add_header'Content-Security-Policy''upgrade-insecure-requests';
Avatar
Discard

did the job for me, thanks

Author Best Answer

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.

Avatar
Discard
Best Answer

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. 

Avatar
Discard
Best Answer

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;
}
Avatar
Discard
Best Answer

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

Is it working by your solution?

Avatar
Discard
Author

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.

Related Posts Replies Views Activity
3
Jun 25
1670
0
Mar 25
1710
1
Mar 25
1804
2
Jul 24
4380
1
May 24
2755