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

Stuart Douglas sdouglas at redhat.com
Mon Jul 4 23:32:44 EDT 2016


Looks like this was an oversight, we added support for this in the
Wildfly HTTP upgrade support, but not websockets.

I have added support for this into the 1.4.x and 2.0.x branches
(https://issues.jboss.org/browse/UNDERTOW-760).

Stuart

On Tue, Jul 5, 2016 at 12:52 PM, electrotype <electrotype at gmail.com> wrote:
> Are you saying it is something you will probably implement in a future release?
>
> Is there an issue I can follow?
>
> Thanks for the help.
>
> Julien
>
> On 2016-07-04 22:13, Stuart Douglas wrote:
>> 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
>
> _______________________________________________
> 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