title: Websockets not connected behind proxy
body: <p>This is quite common problem, but I cannot find a solution to my specific case. I'm using Glassfish 4.1.1 and my application implements Websockets. </p>
  
  <p>On a client side I'm connecting to WS-server simply by:</p>
  
  <pre><code>var serviceLocation = "ws://" + window.location.host + window.location.pathname + "dialog/";
  var wsocket = new WebSocket(serviceLocation + token_var);
  </code></pre>
  
  <p>On a server side websockets are implemented via @ServerEndpoint functionality and looks very common:</p>
  
  <pre><code>@ServerEndpoint(value = "/dialog/{token}", decoders = DialogMessageDecoder.class)
  public class DialogWebsoketEndpoint {
  
      @OnOpen
      public void open(final Session session, @PathParam("token") final String token) { ... }
  etc.
  }
  </code></pre>
  
  <p>Everything works fine up to the moment when customer tries to connect behind proxy.
  Using this test: <a href="http://websocketstest.com/" rel="noreferrer">http://websocketstest.com/</a> I've found that computer of the customer works behind http-proxy 1.1.
  He cannot connect to websockets, onopen simply do not fire at all. wsoscket.readyState never become 1.</p>
  
  <p>How can I tune my ServerEndpoint to make this code work even when customer is connecting behind proxy?</p>
  
  <p>Thank you in advance!</p>
  
  <p>UPDATE: I would provide a screenshot with websocketstest at that computer:<a href="https://i.stack.imgur.com/qKcBO.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/qKcBO.jpg" alt="enter image description here"></a></p>
  
  <p>On my computer it seems similarly except one thing:
  HTTP Proxy: NO.</p>