How to reverse proxy from apache2 container to emqx container that uses websockets?

33 views Asked by At

I am switching from NGINX to Apache2. I had NGINX server in Docker container that listened to the port 80 and 443 only and redirected /mqtt to the emqx(MQTT) using the folowing configuration:

    proxy_pass http://emqx_2:8083;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    }

and it worked perfectly. Now I have to switch to Apache2 which is also in docker container and it too listens only to port 80 and 443. I tried this Apache2 configuration:

   ProxyPass /mqtt http://emqx_2:8083
   ProxyPassReverse /mqtt http://emqx_2:8083 

But when I go to my page I get "WebSocket connection to 'ws://staging.booky.tttech.com/mqtt' failed"

I have installed these modules: proxy, proxy_http, proxy_wstunnel, ssl

Nginx, apache and emqx container are in the same docker network.

I've tried many things already but to no avail. Any help is welcome.

0

There are 0 answers