odoo ssl longpolling proxypass

I have increased odoo from threaded mode to workers = 9 to improve stability issues when there is lot of users. Now it is working perfectly but odoo chat is not being redirected on apache.

i found redirect in /etc/httpd/conf.d/ssl.conf to 8069 but missing 8072 which is longpolling port for odoo chat.

How do i implement this without messing up default bahmni ssl setup by the installer ?

ProxyPass /longpolling/        http://localhost:8072/longpolling/ retry=0
ProxyPassReverse /longpolling/ http://localhost:8072/longpolling/ retry=0
ProxyPass /                    http://localhost:8069/ retry=0
ProxyPassReverse /             http://localhost:8069/ retry=0

you can create another conf file specifically for odoo you will notice that there is a rewrite rule in ssl.conf to a particular port. you would need to define another routing similarly

So this is the lines i have pinned down /opt/bahmni-web/etc/ssl.conf

#erp-ssl RewriteCond %{HTTP_HOST} ^openerp.(.) RewriteRule (.) http://localhost:8069$1 [P]

it seems the whole directory is passed to localhost:8069 I now need to [P] pass erp.hospital.domain/longpolling to localhost:8072 which i have no idea how.

Can anyone help solve this issue ? can we replace this whole block with proxy rule instead of mod_rewrite? I have no experience in rewriteCond or rules and since [P] is essentialy porxyPass

such as

ProxyPreserveHost On
ProxyPass /longpolling/        http://localhost:8072/longpolling/ retry=0
ProxyPassReverse /longpolling/ http://localhost:8072/longpolling/ retry=0
ProxyPass /                    http://localhost:8069/ retry=0
ProxyPassReverse /             http://localhost:8069/ retry=0

After dozen tries i should giveup and ask for proper help. what am i not getting here ?

RewriteCond %{REQUEST_URI} ^/longpolling/*

RewriteRule (.*) http://localhost:8072$1 [P]

please help :slight_smile: after much trail i was not able to make longpolling for ODOO chat available in bahmni setup.

curl http://localhost:8072 returns just fine. how do i rewrite https://sub.domain.tld/longpolling/ to http://localhost:8072 below setup seems to redir domain.tld/longpolling to http://locahost:8072

RewriteEngine on

RewriteCond %{REQUEST_URI} ^/openmrs/* RewriteCond %{HTTP_COOKIE} ^.JSESSIONID=([^;]+) RewriteRule ^.$ - [CO=reporting_session:%1:%{HTTP_HOST}:86400:/:true:true]

RequestHeader set “X-Forwarded-Proto” “https”

#erp-ssl RewriteCond %{HTTP_HOST} ^openerp.(.) RewriteRule (.) http://localhost:8069$1 [P]

RewriteCond %{REQUEST_URI} ^/longpolling/* RewriteRule (.*) http://localhost:8072$1 [P]

#https rules for authentication

      ProxyPass /go http://localhost:8153/go
      ProxyPassReverse /go http://localhost:8153/go

        Alias /bahmni /var/www/bahmniapps
            Alias /document_images /home/bahmni/document_images
            Alias /bahmni_config /var/www/bahmni_config
            Alias /implementation_config /var/www/implementation_config
            Alias /bahmni_revisions /var/www/bahmni_revisions
            Alias /uploaded_results /home/bahmni/uploaded_results
            Alias /uploaded-files /home/bahmni/uploaded-files

        Redirect permanent /home /bahmni/home/
            WSGIDaemonProcess client_side_logging user=apache group=apache threads=1
        WSGIScriptAlias /log /var/www/client_side_logging/client_side_logging.wsgi

        <Directory /var/www/client_side_logging>
        WSGIProcessGroup client_side_logging
        WSGIApplicationGroup %{GLOBAL}
        Require all granted

I am not sure how to solve your exact problem. Maybe this Proxy rules file can guide you to the right path? It is the docker proxy file by @Mekom that directs Bahmni calls to the right sub-system.

https://github.com/mekomsolutions/bahmni-docker/blob/master/proxy/resources/proxy-rules

And two additional links on longpolling Odoo:

  1. https://www.odoo.com/forum/help-1/odoo-10-ce-chat-is-not-refreshing-on-ssl-connection-118876
  2. https://stackoverflow.com/questions/68132598/odoo-nginx-polling-process-cant-connect-to-db-over-a-nginx-reverse-proxy
1 Like

Hello @Mekom ,

Thanks for the sample config for proxy,

Could you advice how to do reverse proxy for odoo to accessible on path like /web or /odoo instead of port 8069?

Cc: @gsluthra and @angshuonline