absmach / magistrala

Industrial IoT Messaging and Device Management Platform
https://www.abstractmachines.fr/magistrala.html
Apache License 2.0
2.49k stars 676 forks source link

Can't Proxy pass to mainflux mqtt adapter over WS in Nginx #1037

Closed longlnk closed 4 years ago

longlnk commented 4 years ago

I can't connect mqtt over WS in Nginx use verne cluster image

image

I only can connect mqtt over WS in mqtt in Mqtt-adapter image

Please help me!

chinhnguyentrung commented 4 years ago

Address WS Verne: ws://ip:port/mqtt -> proxy pass nginx: proxy_pass http://mqtt_ws_cluster/mqtt;

longlnk commented 4 years ago

Address WS Verne: ws://ip:port/mqtt -> proxy pass nginx: proxy_pass http://mqtt_ws_cluster/mqtt;

Hi,

My nginx'config current, Can you help me?, because location is /mqtt/ based mainflux's nginx

image

blokovi commented 4 years ago

As @chinhnguyentrung already said, try edit this last line like this: proxy_pass http://mqtt_ws_cluster/mqtt; because Verne accepts ws connection on /mqtt path

longlnk commented 4 years ago

Hi all, It worked, I edit:

Proxy pass to mainflux-mqtt-adapter over WS

    location /mqtt {
        include snippets/proxy-headers.conf;
        include snippets/ws-upgrade.conf;
        proxy_pass http://mqtt_ws_cluster/mqtt;
    }

localtion /mqtt not /mqtt/

And add environment on Nginx container: DOCKER_VERNEMQ_PLUGINSVMQ_PASSWD: "off" DOCKER_VERNEMQ_PLUGINS__VMQ_ACL: "off" DOCKER_VERNEMQ_PLUGINSMFX_AUTH: "on" DOCKER_VERNEMQ_PLUGINSMFX_AUTH__PATH: /mainflux/_build/default DOCKER_VERNEMQ_LOGCONSOLE__LEVEL: debug

Thanks all!