This question has been flagged
5 Replies
4415 Views

I am trying to run odoo with traefik and everything works except the the website editor which loads an iframe with an http url which breaks the mixed content rule. What I tried to fix this issue was to pass the proto header with traefik, I also set the base.url to https and set it to freeze. And I tried to allow insecure headers but nothing works and I still get an insecure frame error. So now my question is did anybody got a working config with traefik(v2) and odoo(v16) that you can share with me? I can share my config later but for some reason this post will not get submitted so I am first trying to ask this question without the code.

Avatar
Discard

same problem here...

I'm exactly like you. Don't know how to proceed

I have the same problem, no one has found the solution?

Best Answer

This is probably due to a missing middleware in Traefik, which causes problems for Odoo 16. The traefik.http.middlewares.odoo-header.headers.contentSecurityPolicy=upgrade-insecure-requests​ label configures a middleware called "odoo-headers" to enforce the Content Security Policy header with the value "upgrade-insecure-requests". This header instructs the browser to upgrade any insecure HTTP requests to HTTPS before making the request. The traefik.http.routers.odoo.middlewares=odoo-headers​ label associates the "odoo" router with the "odoo-headers" middleware, which will process requests caught by the router to upgrade insecure requests. You can check out my blog post how to setup Traefik for Odoo (I have configured many Odoo instances with this configuration):  Setting up a reverse proxy for Odoo with Nginx Proxy Manager in Docker.

I hope this helps!


Avatar
Discard
Best Answer

Has anyone found a solution to this problem? https://github.com/odoo/odoo/issues/104597


look at this https://github.com/odoo/odoo/issues/104947

Avatar
Discard
Best Answer

The "Mixed Content" error typically occurs when you are serving content over both HTTP and HTTPS. This can happen when you have SSL enabled on your website but some of the resources are still being loaded over HTTP.

In the case of Odoo + Traefik + SSL, this error could occur if you are using the Odoo editor to edit your website and some of the resources (such as images or scripts) are being loaded over HTTP instead of HTTPS.

To resolve this error, you will need to ensure that all resources on your website are being served over HTTPS. Here are some steps you can take to fix this issue:

  1. Check your website for mixed content errors: You can use a tool like the "Why No Padlock?" tool to check for mixed content errors on your website. This tool will scan your website and identify any resources that are being loaded over HTTP instead of HTTPS.

  2. Update Odoo configuration to use HTTPS: You need to update Odoo configuration to ensure that all resources are being loaded over HTTPS. You can do this by modifying the "base.url" parameter in the Odoo configuration file to use HTTPS. You can find the configuration file in the Odoo installation directory.

  3. Update Traefik configuration to use HTTPS: Similarly, you will also need to update Traefik configuration to ensure that all resources are being served over HTTPS. You can do this by modifying the Traefik configuration file to use HTTPS.

  4. Update website content: If you still have mixed content errors after updating Odoo and Traefik configuration, you will need to update your website content to ensure that all resources are being loaded over HTTPS. This may involve updating links to resources and ensuring that any custom scripts or stylesheets are being loaded over HTTPS.

Once you have resolved all mixed content errors on your website, the "Mixed Content" error should no longer occur when using the Odoo editor.

Avatar
Discard
Best Answer

same Problem here.

Working with ngnix proxmanager instead of traeffic but still the same problem.
Great to see that nobody cares... ;-(

Avatar
Discard
Best Answer

I had the same issue and continue until now searching how can I fix it

Avatar
Discard

Yes, it is possible to configure Traefik and Odoo to work together with HTTPS, even for the website editor. Here are some steps you can follow:

Configure Traefik to use HTTPS: Make sure that your Traefik configuration is set up to use HTTPS. You can do this by setting up SSL certificates and configuring the Traefik routers and services to use HTTPS.

Set the proxy-mode parameter in the Odoo configuration file: In the Odoo configuration file, set the proxy-mode parameter to True. This tells Odoo to use the X-Forwarded-Proto header that Traefik sends to Odoo to determine whether to use HTTP or HTTPS for links and resources.

Set the base.url parameter in the Odoo configuration file: Set the base.url parameter in the Odoo configuration file to the HTTPS version of your website URL. This ensures that all links and resources loaded by Odoo are using HTTPS.

Update the website editor iframe URL: The website editor iframe URL may still be using HTTP, which can cause the mixed content error. To fix this, you need to update the URL of the iframe to use HTTPS. You can do this by modifying the website.editor route in the Traefik configuration file to add a middleware that updates the iframe URL to use HTTPS.

Here is an example of what the middleware for the website.editor route might look like:

[http.middlewares.website-editor-https-redirect.redirectScheme]
scheme = "https"
permanent = true

[http.routers.website-editor]
rule = "Host(`example.com`) && Path(`/website/editor/*`)"
service = "odoo-website-editor"
middlewares = ["website-editor-https-redirect"]

This middleware redirects the iframe URL to use HTTPS, which should resolve the mixed content error.

I hope this helps! Let me know if you have any other questions.