turnkeylinux / tracker

TurnKey Linux Tracker
https://www.turnkeylinux.org
71 stars 16 forks source link

odoo 16 longpolling is deprecated replaced by websocket #1971

Open icf20 opened 4 months ago

icf20 commented 4 months ago
# Needed for real time message / chat feature (longpolling)
    ProxyPass /longpolling/poll http://127.0.0.1:8072/longpolling/poll/ timeout=200
    ProxyPass /longpolling/poll/ http://127.0.0.1:8072/longpolling/poll/ timeout=200
    ProxyPassReverse /longpolling/poll/ http://127.0.0.1:8072/longpolling/poll/

this needs to be removed from apache2 config no?

JedMeister commented 4 months ago

Thanks for the heads up on this.

Can you confirm that there is no additional config required to make Odoo work as expected after removing this config?

icf20 commented 4 months ago

u need something like this for the websocket no? i am not sure

  RewriteEngine On
  RewriteCond %{HTTP:Upgrade} =websocket [NC]
  RewriteRule /(.*)           ws://127.0.0.1:8069/$1 [P,L]
  RewriteCond %{HTTP:Upgrade} !=websocket [NC]
  RewriteRule /(.*)           http://127.0.0.1:8069/$1 [P,L]

see https://github.com/odoo/odoo/issues/106339

JedMeister commented 4 months ago

Thanks for the hint & the link, plus bring this to my attention in the first place.

I've got my head pretty deep in something else ATM, but I'll have a closer look ASAP.

marcos-mendez commented 3 months ago

I think there is a misunderstanding here. The problem is not the websocket as this is native from any webserver (nginx or apache) the problem is the Directive that is being callend in the config file.

it used to be the longpolling directive now it is called gevent_port = 8072 this directive will be in transition until version 18 (as far as i know)

So what should be done actually (and as recomended a external reverse-proxy nginx by Odoo)

is to set a websocket location as in this example:

` server { listen 80; listen 443; server_name www.example.com; return 301 $scheme://example.com$request_uri; }

server { server_name example.com;

The internal IP of the VM that hosts your Apache config

    set $upstream 192.168.1.160;

    #Odoo LongPolling COMMENT if not Odoo
    location /longpolling {
            proxy_pass http://$upstream:8072;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /websocket {
            proxy_pass http://$upstream:8072;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
    }

    location / {
            proxy_pass_header Authorization;
            proxy_pass http://$upstream:8069;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_http_version 1.1;
            proxy_set_header Connection “”;
            proxy_buffering off;
            client_max_body_size 0;
            proxy_read_timeout 36000s;
            proxy_redirect off;
    }

} `

I think this is not a issue from the odoo tkl app actually is an issue of the Reverse Proxy settings.

Any question i'm glad to help