<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hi,</p>
    <p>I see some people think the HTTP request for a WebSocket upgrade
      shouldn't honnor 301/302 redirects. But the spec seems to say it
      is ok:<br>
      <br>
      "<i>If the status code received from the server is not 101, the</i><i><br>
      </i><i>client handles the response per HTTP [RFC2616] procedures. 
        In</i><i><br>
      </i><i>particular, the client might perform authentication if it</i><i><br>
      </i><i>receives a 401 status code; the server might redirect the
        client</i><i><br>
      </i><i>using a 3xx status code (but clients are not required to
        follow</i><i><br>
      </i><i>them), etc.  Otherwise, proceed as follows</i>."<br>
      <br>
      "<i>The server MAY redirect the client using a 3xx status code</i><i><br>
      </i><i>[RFC2616].  Note that this step can happen together with,
        before,</i><i><br>
      </i><i>or after the optional authentication step described above.</i>"<br>
      <br>
      <a class="moz-txt-link-freetext" href="https://tools.ietf.org/html/rfc6455">https://tools.ietf.org/html/rfc6455</a><br>
      <br>
      In the version of Undertow I use, 1.2.12.Final, I see that the
      redirect response is handled by <i>org.xnio.http.HttpUpgrade</i>
      :<br>
      <br>
      private void handleRedirect(final HttpUpgradeParser parser) {<br>
          List&lt;String&gt; location =
      parser.getHeaders().get("location");<br>
          future.setException(new RedirectException(msg.redirect(),
      parser.getResponseCode(), location == null ? null :
      location.get(0)));<br>
      }<br>
      <br>
      Is it the same behavior in most recent Undertow releases?<br>
      <br>
      Related discussion:
      <a class="moz-txt-link-freetext" href="https://github.com/sta/websocket-sharp/issues/42">https://github.com/sta/websocket-sharp/issues/42</a><br>
      <br>
      Thanks,<br>
      <br>
      Julien<br>
      <br>
      <br>
    </p>
  </body>
</html>