[undertow-dev] Redirects during the handshake of a WebSocket upgrade request

Stuart Douglas sdouglas at redhat.com
Mon Jul 4 22:13:39 EDT 2016


Yes, Undertow should respect the redirect response code.

Stuart

On Tue, Jul 5, 2016 at 10:43 AM, electrotype <electrotype at gmail.com> wrote:
> Hi,
>
> 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:
>
> "If the status code received from the server is not 101, the
> client handles the response per HTTP [RFC2616] procedures.  In
> particular, the client might perform authentication if it
> receives a 401 status code; the server might redirect the client
> using a 3xx status code (but clients are not required to follow
> them), etc.  Otherwise, proceed as follows."
>
> "The server MAY redirect the client using a 3xx status code
> [RFC2616].  Note that this step can happen together with, before,
> or after the optional authentication step described above."
>
> https://tools.ietf.org/html/rfc6455
>
> In the version of Undertow I use, 1.2.12.Final, I see that the redirect
> response is handled by org.xnio.http.HttpUpgrade :
>
> private void handleRedirect(final HttpUpgradeParser parser) {
>     List<String> location = parser.getHeaders().get("location");
>     future.setException(new RedirectException(msg.redirect(),
> parser.getResponseCode(), location == null ? null : location.get(0)));
> }
>
> Is it the same behavior in most recent Undertow releases?
>
> Related discussion: https://github.com/sta/websocket-sharp/issues/42
>
> Thanks,
>
> Julien
>
>
>
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev


More information about the undertow-dev mailing list