Skip to Content
Menu
This question has been flagged

How can I make Odoo Discuss (Live Chat) update messages without needing a page refresh?

Is my Nginx configuration correct for longpolling and WebSockets?

Do I need to adjust any Odoo settings for WebSockets to work properly?


Any guidance would be greatly appreciated!


(NGINX Sample File)


# Upstream Odoo servers

upstream odoo17 {

    server 127.0.0.1:1700;

}


upstream odoo17chat {

    server 127.0.0.1:8072;

}


# ---------------------- SHOP.COM ----------------------

server {

    listen 443 ssl;

    server_name shop.com www.shop.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 Files

    access_log /var/log/nginx/shop.access.log;

    error_log /var/log/nginx/shop.error.log;


    # Redirect requests to Odoo Backend Server

    location / {

        proxy_redirect off;

        proxy_pass http://odoo17;

    }


    location /longpolling {

        proxy_pass http://odoo17chat;

        proxy_set_header Upgrade $http_upgrade;

        proxy_set_header Connection "upgrade";

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_set_header Host $host;

        proxy_http_version 1.1;

    }


    # SSL Configuration

    ssl_certificate /etc/letsencrypt/live/shop.com/fullchain.pem;

    ssl_certificate_key /etc/letsencrypt/live/shop.com/privkey.pem;

    include /etc/letsencrypt/options-ssl-nginx.conf;

    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

}


# Redirect HTTP to HTTPS

server {

    listen 80;

    server_name shop.com www.shop.com;

    return 301 https://$host$request_uri;

}


# ---------------------- WEB.SHOP.COM ----------------------

server {

    listen 443 ssl;

    server_name web.shop.com www.web.shop.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 Files

    access_log /var/log/nginx/web_shop.access.log;

    error_log /var/log/nginx/web_shop.error.log;


    # Redirect requests to Odoo Backend Server

    location / {

        proxy_redirect off;

        proxy_pass http://odoo17;

    }


    location /longpolling {

        proxy_pass http://odoo17chat;

        proxy_set_header Upgrade $http_upgrade;

        proxy_set_header Connection "upgrade";

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_set_header Host $host;

        proxy_http_version 1.1;

    }


    ssl_certificate /etc/letsencrypt/live/web.shop.com/fullchain.pem;

    ssl_certificate_key /etc/letsencrypt/live/web.shop.com/privkey.pem;

}


(Sample Conf File for Odoo17)


[options]

admin_passwd = ****

http_port = 1700

logfile = /var/log/odoo/odoo17.log

addons_path = /opt/odoo17/odoo17/addons,/opt/odoo17/odoo17/custom

proxy_mode = True

workers = 2

db_name = False

db_user = odoo17

db_port = 5432

db_host = localhost

db_password = ****

xmlrpc_interface = 127.0.0.1

longpolling_port = 8072

dbfilter = ^%h$

Avatar
Discard

Hi, can you confirm if you use any load balancers?

Related Posts Replies Views Activity
1
May 25
976
1
Jul 23
3087
0
Apr 21
3035
2
Sep 24
1525
1
May 24
2796