title: Can't access websocket (ws://) url using marathon-lb
body: <p>I have a container running a jupyter gateway which requires two urls to be accessible a http and websocket url.</p>
  
  <p>On localhost, for example, these urls are <code>http://127.0.0.1:8888</code> and <code>ws://127.0.0.1:8888</code>.</p>
  
  <p>When I start my app with marathon and ssh into the mesos slave running the container I can access both of these urls functionality using my client that makes requests to the jupyter gateway. Which tells me the jupyter gateway in the container is working fine.</p>
  
  <p>However when I am trying to access the jupyter gateway through the marathon load balancer my client tells me it can reach the <code>http://</code> url fine but it times out when trying to connect to the <code>ws://</code> url which I need to be able to access.</p>
  
  <p>I believe marathon-lb supports forwarding websockets without extra configuration so I am not sure what the issue is but I suspect it could do with the following haproxy config in my marathon app labels.</p>
  
  <p>Labels:</p>
  
  <pre><code>HAPROXY_0_MODE=http
  HAPROXY_0_PATH=/jupyter-gateway-container-path
  HAPROXY_0_VHOST=ourwebsite.com
  </code></pre>
  
  <p>EDIT to add more logs:</p>
  
  <p>Below are the client and server logs. The server is the Jupyter gateway. The client is the python client they provide in the examples repository. You can see that a https:// request goes through successfully from the client and it shows a 201 POST in the server's log. But the ws:// request times out.</p>
  
  <p>Client log https:// request is fine but ws:// times out.</p>
  
  <pre><code>  $ python client.py
  https://&lt;websitename&gt;.io/7c5e1967-b8e4-4e6d-bb68-80881d7f3de1
  ws://&lt;websitename&gt;.io/7c5e1967-b8e4-4e6d-bb68-80881d7f3de1
  Created kernel 11e9b48b-d0b9-4419-b13a-205eaee7f2c7. Connect other clients with the following command:
              docker-compose run client --kernel-id=11e9b48b-d0b9-4419-b13a-205eaee7f2c7
  
  ws://&lt;websitename&gt;.io/7c5e1967-b8e4-4e6d-bb68-80881d7f3de1/api/kernels/11e9b48b-d0b9-4419-b13a-205eaee7f2c7/channels
  Traceback (most recent call last):
    File "client.py", line 178, in &lt;module&gt;
      IOLoop.current().run_sync(main)
    File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line 453, in run_sync
      return future_cell[0].result()
    File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 232, in result
      raise_exc_info(self._exc_info)
    File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1014, in run
      yielded = self.gen.throw(*exc_info)
    File "client.py", line 125, in main
      ws = yield websocket_connect(ws_req)
    File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1008, in run
      value = future.result()
    File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 232, in result
      raise_exc_info(self._exc_info)
    File "&lt;string&gt;", line 3, in raise_exc_info
  tornado.httpclient.HTTPError: HTTP 599: Timeout
  </code></pre>
  
  <p>Server log recieves https request ok, no mention of further connections.</p>
  
  <pre><code>[KernelGatewayApp] Jupyter Kernel Gateway at http://0.0.0.0:8888
  [KernelGatewayApp] Kernel started: 11e9b48b-d0b9-4419-b13a-205eaee7f2c7
  [I 170519 01:12:22 web:1971] 201 POST /7c5e1967-b8e4-4e6d-bb68-80881d7f3de1/api/kernels (10.0.0.173) 35.77ms
  </code></pre>