Reviving the Odoo16 on prem server
As we have been going for a long time on switching away from our old FileMaker Pro 5.5 (which still works) towards a newer modern software, we have been meddling since 2019 with Odoo. Finally turning it around, and activating our server once more, I want to share some of the tidbits that saved the day in the end
- Installation of your certbot on your on prem odoo server will fail if your portforward to 80 or 443 is not explicitly set (we were pushing to one of Odoo's base ports in our NAT)
- After installation of our certificate, our Odoo web editor was unable to be loaded anymore. Using browser developer mode we found that there was a mixed content error which created this problem.
- All attempts at finding the source of the problem inside Odoo postgresql / source code, including our own assets failed to find the root cause of the mixed content. Including tracing the redirect logic to /website/force/<id> in main.py controller.
- Verified web.base.url set https, as it seems ours always flipped back to http, we enforced the free base URL in the end as well.
All to https
We kept hitting the mixed content, and moved away from the AI generated answer and hit a possible solution: Redirect all http to https.
- Option 1: In 443 /location of your nginx config:
proxy_redirect http:// https://;
This forces all http traffic to https, this proof for older browsers. Redirects headers and has server side control - Option 2: In 443 /location of your nginx config:
add_header Content-Security-Policy "upgrade-insecure-requests";
This also forces all http traffic to https, is only supported on newer browsers but also supports iframes and has browser enforcement
- Option 1: In 443 /location of your nginx config:
Do mind that this might break any explicit HTTP redirects you require on that server.
Original source of solution: Mixed content - Request from an insecure resource | Odoo
Official bugreport by odoo:
Website editor not work on HTTPS · Issue #104597 · odoo/odoo (github.com)
Listed solution on Odoo Configuration:
System configuration — Odoo 16.0 documentation