This question has been flagged
4 Replies
20114 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

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

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.