coollabsio / coolify

An open-source & self-hostable Heroku / Netlify / Vercel alternative.
https://coolify.io
Apache License 2.0
31.69k stars 1.63k forks source link

[Bug]: Unable to edit Odoo 17 website. Mixed Content Error #3441

Open BayBreezy opened 4 days ago

BayBreezy commented 4 days ago

Description

I created an Odoo 17 website with the 1-click service. I was able to add the Recruitment module. When I tried editing the Website, the editor would not open, I kept getting this error in the web console

Mixed Content: The page at 'https://odoo.coolify.behonbaker.com/web#action=247&cids=1&menu_id=176' was loaded over HTTPS, but requested an insecure frame 'http://odoo.coolify.behonbaker.com/'. This request has been blocked; the content must be served over HTTPS.

After some amount of digging, i stumbled on this post: Mixed Content Error where someone stated that adding a few headers to the Nginx config would fix the problem.

I am not sure of how to do this in the UI of Coolify. This is what I see for this service:

image

Can you help me or point me to the docs that say how we can add the different heders to the proxy file?

Minimal Reproduction (if possible, example repository)

Exception or Error

Mixed Content: The page at 'https://odoo.coolify.behonbaker.com/web#action=247&cids=1&menu_id=176' was loaded over HTTPS, but requested an insecure frame 'http://odoo.coolify.behonbaker.com/'. This request has been blocked; the content must be served over HTTPS.

Version

4.0.0-beta.335

Cloud?

djsisson commented 3 days ago

im not sure which part is broken for you

image

image

BayBreezy commented 3 days ago

The website editor. Try editing the website. I did get the recruitment module to work no problem

djsisson commented 3 days ago

@BayBreezy this took way to long to fix, none of the suggestions worked

image

add a transform rule in cloudflare

modify response headers

match your odoo domain then add dynamic Location and set value to concat("https://", substring(http.response.headers["location"][0], 7))

please note i also have amended some traefik labels, but im not sure they are even necessary at this point

BayBreezy commented 3 days ago

Thanks for the hard work @djsisson , Sadly, I am not using cloudflare. I just have the app started from coolify. Can you share the labels added to the compose file? Thanks again

djsisson commented 3 days ago

@BayBreezy

- traefik.http.routers.odoo.entryPoints=http
- traefik.http.middlewares.csp-header.headers.customResponseHeaders.Content-Security-Policy=upgrade-insecure-requests
- traefik.http.routers.odoo.middlewares=gzip,csp-header
- 'traefik.http.routers.odoo.rule=Host(`odoo.domain.com`) && PathPrefix(`/`)'
- traefik.http.routers.odoo.priority=100

this is for http, you would need to modify for https

also i added this volume mount

-
        type: bind
        source: ./odoo.conf
        target: /etc/odoo/odoo.conf
        contents: |
          [options]
            addons_path = /mnt/extra-addons
            data_dir = /var/lib/odoo
            proxy_mode = True

i also modified the web.base.url and web.base.url.freeze in Settings -> Technical -> System Parameters in dev mode

djsisson commented 3 days ago

note the volume mount will remove the admin password if u have one set up

BayBreezy commented 3 days ago

Ok. Thank you. I will give this a shot when I am around the computer again. I will let you know if it helped

BayBreezy commented 3 days ago

@djsisson well that didn't work :(

djsisson commented 3 days ago

@BayBreezy the other option is to install a plugin for traefik that modifies headers, and the nyou can jsut modify the Location header using a regexp, similar to what i did in cloudflare

BayBreezy commented 3 days ago

@djsisson , I will have to do that... after learning how ytaefik works lolol. I only know about traefik through coolify. Been using nginx all my life. But If i get it to work, I will share my findings. Thanks for the help. I appreciate it

djsisson commented 3 days ago

Well maybe you could add nginx to the compose and route all traffic through that