I do not get any error when I access and login to odoo with the below default URL
However, after setting up SSL with nginx proxy pass I get the below error after login with my credentials
Below is nginx configuration for setting up proxy pass to odoo
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name erp.mybank.com; # managed by Certbot
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
proxy_pass http://localhost:8069;
}
location /web {
proxy_pass http://localhost:8069;
}
Error output:
Error: Couldn't load css dependency: https://erp.mybank.com/hrms_dashboard/static/src/css/lib/nv.d3.css
at HTMLLinkElement.<anonymous> (https://erp.mybank.com/web/assets/835-f142dd9/web.assets_common.min.js:4674:359)
at HTMLLinkElement.dispatch (https://erp.mybank.com/web/assets/835-f142dd9/web.assets_common.min.js:1785:447)
at HTMLLinkElement.elemData.handle (https://erp.mybank.com/web/assets/835-f142dd9/web.assets_common.min.js:1771:166)
There is not many suggestions/solution online.
Any clues on how to resolve this?
CodePudding user response:
Your nginx configuration is not enough to load all static assets for Odoo, you need to follow Odoo official documentation for deploying Odoo with Nginx as a reverse proxy server. Here is the simplest configuration for your setup:
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}
# http -> https
server {
listen 80;
server_name erp.mybank.com;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# Add Headers for odoo proxy mode
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
# log
access_log /var/log/nginx/odoo.access.log;
error_log /var/log/nginx/odoo.error.log;
# Redirect longpoll requests to odoo longpolling port
location /longpolling {
proxy_pass http://odoochat;
}
# Redirect requests to odoo backend server
location / {
proxy_redirect off;
proxy_pass http://odoo;
}
# common gzip
gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
For more information please follow the official documentation.