Nginx – Can not using websocket with nginx

activemqdockernginxwebsocket

I am using Activemq as broker, client side is Paho js to send websocket request(ws protocol).
Everything work fine on server, but when the server start to set nginx as proxy, the client can not connect to server( but I can connect to Activemq UI web). My nginx setting is:

map $http_upgrade $connection_upgrade {
     default upgrade;
     '' close;
}
server {
     listen 16614;
     server_name mq.mysite.com;
     access_log /var/log/docker/nginx/access_activemq.log activemq_custom;

     location / {
           proxy_pass  http://192.168.10.13:16614; 
           proxy_http_version 1.1;
           proxy_set_header Upgrade $http_upgrade;
           proxy_set_header Connection $connection_upgrade;

     }
}

I am using 80 port to listen ActiveMQ webUI, and 16614 to ws protocol.

Is there any missing step?

Best Answer

The problem come from Docker, nginx -s reload command sometimes does not work exactle, I have to restart Nginx container.