Skip to Content
Menu
This question has been flagged
5 Replies
2566 Views

My Odoo17 Community Edition is an SSL site and when I go to the Website App, the iframe sends an HTTP request that is blocked by the browser. the page is not responding it keeps waiting. Can anyone answer what I should do? 

Chrome says:Mixed Content: The page at 'example.com/'. This request has been blocked; the content must be served over HTTPS.

Thank you!

Avatar
Discard
Best Answer

In case of our website we follow the these steps. Since your site uses HTTPS, all resources, including those within iframes, must also be served over HTTPS. To resolve this:

  1. Update the iframe URL: Ensure that the URL in the iframe is also using HTTPS. For example, change http://example.com to https://example.com.
  2. Check embedded content: Verify that all resources (images, scripts, etc.) within the iframe are being loaded over HTTPS.
  3. Review site settings: Ensure that your Odoo settings and any plugins or extensions used are configured to support HTTPS.

After making these adjustments, clear your browser cache and reload the page. This should resolve the issue with the blocked HTTP request.

Avatar
Discard
Best Answer

In case somebody is facing the same issue, I had the problem and for me this was what was causing this error:

proxy_pass_request_headers on;
proxy_set_headers Host $host;

These parameters were redirecting the https requests towards an http. I removed them from "location /" and added them in a separate bloc "location /api" and everything was working fine again.

Avatar
Discard
Best Answer

The issue you're facing is the iframe within the Odoo Website App preview using an HTTP link while your website is configured for HTTPS. This creates a mixed content error. Here are two potential solutions to address this:

Solution 1: Modifying Odoo Configuration

  1. Locate your odoo.conf file: This is typically found in /etc/odoo/.
  2. Edit the file: Open the file using a text editor.
  3. Set web.base.url: Look for the [options] section and ensure the web.base.url parameter is set to the full HTTPS URL of your website, including the protocol (https://).
  4. Check workers.force_https: If the option workers.force_https = True exists within the [options] section, make sure it's enabled. This instructs Odoo workers to always use HTTPS for communication.

Solution 2: Modifying Nginx Configuration (If Applicable):

If you're using Nginx as a reverse proxy, you can configure it to rewrite the iframe URL to use HTTPS:

  1. Locate your Nginx configuration file: This is usually found in /etc/nginx/sites-enabled/ or /etc/nginx/conf.d/.
  2. Edit the file: Open the file with a text editor.
  3. Locate the Odoo server block: Find the section of your Nginx configuration that defines how it interacts with your Odoo server.
  4. Add a rewrite rule: Inside the server block, add a rewrite rule to modify the iframe URL. Here's an example:

​ location / { # ... other Nginx configuration ... rewrite ^/(.*)$ https://$host/$1 permanent; } 

This rule rewrites all HTTP requests to their HTTPS counterparts, including those potentially generated by the Odoo iframe. 

  • Restart your web server (Nginx) and clear your browser cache after making any configuration changes to see the effects.
  • If you're unsure about modifying configuration files, consider seeking assistance from a system administrator or someone familiar with Odoo and Nginx.

By implementing one of these solutions, you should ensure that the iframe generated by the Website App preview also uses the HTTPS protocol, resolving the mixed content error and allowing the page to load correctly.


Avatar
Discard
Author

Thanks Reply! I have done all these settings, but to no avail. I feel that the links in the iframe are defined by JS, and the http request issued on local machine is blocked by the browser and does not reach the reverse proxy at all.

Author Best Answer

Thanks Reply.

Both Nginx reverse proxy and SSL work fine. When the website App previews the homepage, it will start an iframe. The link of homepage initiated by this iframe is not an SSL link, but an HTTP link. The browser does not allow such access. So it will be blocked.  web.base.url has been set to HTTPS

Avatar
Discard
Best Answer

Hi,

Please add the below line inside your nginx file . you need to add this inside the location

proxy_set_header X-Forwarded-Proto https;


example

location /longpolling {

                proxy_connect_timeout   3600;

                proxy_read_timeout      3600;

                proxy_send_timeout      3600;

                send_timeout            3600;

                proxy_set_header X-Forwarded-Proto https;

                proxy_pass http://127.0.0.1:8072;

        }


After adding it , save the file and restart nginx service


Hope it helps

Avatar
Discard