Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to make websocket works fine, especial for IM chat #4008

Open
icoco opened this issue Mar 12, 2023 · 5 comments
Open

how to make websocket works fine, especial for IM chat #4008

icoco opened this issue Mar 12, 2023 · 5 comments
Assignees

Comments

@icoco
Copy link

icoco commented Mar 12, 2023

Impacted versions:16

Steps to reproduce:

  1. make odoo run gevent server that port is 8072
  2. setup Nginx , config file as follows:
#odoo server
upstream odoo {
  server 127.0.0.1:8020;
}
upstream odoochat {
  server 127.0.0.1:8072;
}
map $http_upgrade $connection_upgrade {
  default upgrade;
  ''      close;
}
 

server {
  listen 80 ; 
  server_name www.mo.com
  proxy_read_timeout 720s;
  proxy_connect_timeout 720s;
  proxy_send_timeout 720s;
 

  ######## log
  access_log /var/log/nginx/odoo.access.log;
  error_log /var/log/nginx/odoo.error.log;

  ######## Redirect websocket requests to odoo gevent port
  location /websocket {
    
    proxy_pass http://odoochat;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    

    proxy_set_header Host $host;
    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; 
    proxy_set_header X-Forwarded-Port $server_port;


    proxy_http_version 1.1; 
  }

  ########## Redirect requests to odoo backend server
  location / {
    # 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;
    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;
}
  1. open discuss page , chat with someone, but can not instant chat at all .

  2. trace the issue , find Nginx error bellows:

upstream sent no valid HTTP/1.0 header while reading response header from upstream, client: 127.0.0.1, server: www.mo.com, request: "GET /websocket HTTP/1.1", upstream: "http://127.0.0.1:8072/websocket", host: "www.mo.com:80"

Current behavior:

open discuss page , chat with someone, but can not instant chat at all , the websocket not works as expected,

Expected behavior:

Hope easy setup the IM feature

Video/Screenshot link (optional):

Support ticket number submitted via odoo.com/help (optional):

maybe not bug or issue, but I think that the online document also too simply that not easy to follow and make the great feature available, if hard deploy I think that no user happy to choice

@AbdelAzizMohamedMousa
Copy link

Based on the error message you provided, it seems that there is an issue with the WebSocket connection between the Nginx server and the Odoo server. This can happen if there is a misconfiguration in your Nginx server that prevents it from properly handling WebSocket connections.

To fix this issue, you can try adding the following configuration to your Nginx server block:
location /longpolling { proxy_pass http://odoochat; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; }

This configuration will tell Nginx to handle WebSocket connections by passing them to the Odoo chat server using long polling.

After adding this configuration, you should restart your Nginx server and try accessing the Odoo chat feature again. If the issue persists, you may need to check your Nginx and Odoo server logs for more information about the problem.

@vava-odoo vava-odoo transferred this issue from odoo/odoo Apr 4, 2023
@Julien00859
Copy link
Member

@tsm-odoo

@Julien00859 Julien00859 removed their assignment Apr 9, 2023
@tsm-odoo
Copy link
Contributor

tsm-odoo commented Apr 13, 2023

Hello @icoco,

I tried to reproduce this issue with the provided steps/configuration file and everything works fine on my side.
Is there any extra configuration that you did not mention?

Also, could you please provide the response headers?

Regards.

@icoco
Copy link
Author

icoco commented Apr 16, 2023

thanks for reply, one thing, where can find the detail configure instruction that can make the LiveChat works perfectly ? I meaning easy follow the guide step by step deploy the chat feature as expected, thanks

@tsm-odoo
Copy link
Contributor

Hello @icoco, https://www.odoo.com/documentation/16.0/administration/install/deploy.html?highlight=nginx#https should be enough. Can you send be the response headers you are receiving for the /websocket route?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants