You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@knox.apache.org by Li Zhou <un...@hotmail.com> on 2017/02/27 02:54:45 UTC

How to pass cookie to websocket backend in knox 0.11.0

Hi, guys:

    I have a web application with websocket, I'm using knox to proxy the app, have 2 services, one for http, and the other for websocket. But seems the websocket can't get the value JSESSIONID in cookie from the knox, I checked in the browser, it did send cookie correctly. The request from browser shows as below, but after knox proxy, I can't get the cookies.


Request URL:wss://9.30.109.105:8443/gateway/default/message-service/messages/topic?name=sqlEditor
Request Method:GET
Status Code:101 Switching Protocols

Response Headers
view source
Connection:Upgrade
Date:Mon, 27 Feb 2017 02:11:29 GMT
Sec-WebSocket-Accept:KPpUPgOW3IZT9M9KlxRAn7JVBYQ=
Upgrade:WebSocket

Request Headers
view source
Accept-Encoding:gzip, deflate, sdch, br
Accept-Language:zh-CN,zh;q=0.8
Authorization:Basic YWRtaW46YWRtaW4tcGFzc3dvcmQ=
Cache-Control:no-cache
Connection:Upgrade
Cookie:JSESSIONID=1balehb45f8z91drorxev1om1d
Host:9.30.109.105:8443
Origin:https://9.30.109.105:8443
Pragma:no-cache
Sec-WebSocket-Extensions:permessage-deflate; client_max_window_bits
Sec-WebSocket-Key:gUYyWYAMCa6JbnJ4jNiVhA==
Sec-WebSocket-Version:13
Upgrade:websocket
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36


How can I configure knox websocket service to pass the cookies? Thanks in advance.


Re: 答复: 答复: How to pass cookie to websocket backend in knox 0.11.0

Posted by Sandeep More <mo...@gmail.com>.
Thanks a lot Li, I'll take a look at them.

On Mon, Feb 27, 2017 at 11:08 PM, Li Zhou <un...@hotmail.com> wrote:

> Hi, Sandeep:
>
>     I opened #894 and #895 for my requirements.
>
>
>     Regards, Li.
> ------------------------------
> *发件人:* Sandeep More <mo...@gmail.com>
> *发送时间:* 2017年2月28日 1:57:24
> *收件人:* user@knox.apache.org
> *主题:* Re: 答复: How to pass cookie to websocket backend in knox 0.11.0
>
> Hello Li,
>
> This is interesting use case, can you elaborate more on it ?
>
> You are right, currently we do not have the ability to rewrite Websocket
> urls, we started off with Zeppelin usecase which was basic Websocket
> support and are planning to expand the functionality more as we encounter
> usecases (like the one that you described)
>
> These usecases are extremely helpful for us know what the community would
> like to have, so thanks for bringing this up ! If you could open a JIRA and
> describe the usecase there that would be much appreciated and we can then
> try to get it in Knox as soon as we can.
>
> Best,
> Sandeep
>
> On Mon, Feb 27, 2017 at 8:42 PM, Li Zhou <un...@hotmail.com> wrote:
>
>> Hi, Sandeep:
>>
>>      Sure, I will open it later. Beside the cookie issue, I also noticed
>> knox websocket service doesn't support url rewrite, which means I need
>> defined multiple services for multiple socket entries. In my case, I want
>> to use /gateway/default/message-service/messages as my socket backend,
>> and use extra path as namespace and query parameters to control code flow.
>> I noticed the route rewrite doesn't work at all. I think this is also a
>> common requirement.
>>
>>
>>     Regards, Li.
>>
>>
>>
>> ------------------------------
>> *发件人:* Sandeep More <mo...@gmail.com>
>> *发送时间:* 2017年2月27日 20:04:47
>> *收件人:* user@knox.apache.org
>> *主题:* Re: How to pass cookie to websocket backend in knox 0.11.0
>>
>> Hello Li,
>>
>> That's a good question, I don't think Knox currently passes session data
>> around, can you open up a JIRA I'll take a look at it.
>>
>> Best,
>> Sandeep
>>
>> On Sun, Feb 26, 2017 at 9:54 PM, Li Zhou <un...@hotmail.com> wrote:
>>
>>> Hi, guys:
>>>
>>>     I have a web application with websocket, I'm using knox to proxy the
>>> app, have 2 services, one for http, and the other for websocket. But seems
>>> the websocket can't get the value JSESSIONID in cookie from the knox, I
>>> checked in the browser, it did send cookie correctly. The request from
>>> browser shows as below, but after knox proxy, I can't get the cookies.
>>>
>>>
>>> Request URL:wss://9.30.109.105:8443/gateway/default/message-service/
>>> messages/topic?name=sqlEditor
>>> Request Method:GET
>>> Status Code:101 Switching Protocols
>>>
>>> Response Headers
>>> view source
>>> Connection:Upgrade
>>> Date:Mon, 27 Feb 2017 02:11:29 GMT
>>> Sec-WebSocket-Accept:KPpUPgOW3IZT9M9KlxRAn7JVBYQ=
>>> Upgrade:WebSocket
>>>
>>> Request Headers
>>> view source
>>> Accept-Encoding:gzip, deflate, sdch, br
>>> Accept-Language:zh-CN,zh;q=0.8
>>> Authorization:Basic YWRtaW46YWRtaW4tcGFzc3dvcmQ=
>>> Cache-Control:no-cache
>>> Connection:Upgrade
>>> Cookie:JSESSIONID=1balehb45f8z91drorxev1om1d
>>> Host:9.30.109.105:8443
>>> Origin:https://9.30.109.105:8443
>>> Pragma:no-cache
>>> Sec-WebSocket-Extensions:permessage-deflate; client_max_window_bits
>>> Sec-WebSocket-Key:gUYyWYAMCa6JbnJ4jNiVhA==
>>> Sec-WebSocket-Version:13
>>> Upgrade:websocket
>>> User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36
>>> (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
>>>
>>> How can I configure knox websocket service to pass the cookies? Thanks
>>> in advance.
>>>
>>>
>>>
>>
>

答复: 答复: How to pass cookie to websocket backend in knox 0.11.0

Posted by Li Zhou <un...@hotmail.com>.
Hi, Sandeep:

    I opened #894 and #895 for my requirements.


    Regards, Li.

________________________________
发件人: Sandeep More <mo...@gmail.com>
发送时间: 2017年2月28日 1:57:24
收件人: user@knox.apache.org
主题: Re: 答复: How to pass cookie to websocket backend in knox 0.11.0

Hello Li,

This is interesting use case, can you elaborate more on it ?

You are right, currently we do not have the ability to rewrite Websocket urls, we started off with Zeppelin usecase which was basic Websocket support and are planning to expand the functionality more as we encounter usecases (like the one that you described)

These usecases are extremely helpful for us know what the community would like to have, so thanks for bringing this up ! If you could open a JIRA and describe the usecase there that would be much appreciated and we can then try to get it in Knox as soon as we can.

Best,
Sandeep

On Mon, Feb 27, 2017 at 8:42 PM, Li Zhou <un...@hotmail.com>> wrote:

Hi, Sandeep:

     Sure, I will open it later. Beside the cookie issue, I also noticed knox websocket service doesn't support url rewrite, which means I need defined multiple services for multiple socket entries. In my case, I want to use /gateway/default/message-service/messages as my socket backend, and use extra path as namespace and query parameters to control code flow. I noticed the route rewrite doesn't work at all. I think this is also a common requirement.


    Regards, Li.




________________________________
发件人: Sandeep More <mo...@gmail.com>>
发送时间: 2017年2月27日 20:04:47
收件人: user@knox.apache.org<ma...@knox.apache.org>
主题: Re: How to pass cookie to websocket backend in knox 0.11.0

Hello Li,

That's a good question, I don't think Knox currently passes session data around, can you open up a JIRA I'll take a look at it.

Best,
Sandeep

On Sun, Feb 26, 2017 at 9:54 PM, Li Zhou <un...@hotmail.com>> wrote:

Hi, guys:

    I have a web application with websocket, I'm using knox to proxy the app, have 2 services, one for http, and the other for websocket. But seems the websocket can't get the value JSESSIONID in cookie from the knox, I checked in the browser, it did send cookie correctly. The request from browser shows as below, but after knox proxy, I can't get the cookies.


Request URL:wss://9.30.109.105:8443/gateway/default/message-service/messages/topic?name=sqlEditor<http://9.30.109.105:8443/gateway/default/message-service/messages/topic?name=sqlEditor>
Request Method:GET
Status Code:101 Switching Protocols

Response Headers
view source
Connection:Upgrade
Date:Mon, 27 Feb 2017 02:11:29 GMT
Sec-WebSocket-Accept:KPpUPgOW3IZT9M9KlxRAn7JVBYQ=
Upgrade:WebSocket

Request Headers
view source
Accept-Encoding:gzip, deflate, sdch, br
Accept-Language:zh-CN,zh;q=0.8
Authorization:Basic YWRtaW46YWRtaW4tcGFzc3dvcmQ=
Cache-Control:no-cache
Connection:Upgrade
Cookie:JSESSIONID=1balehb45f8z91drorxev1om1d
Host:9.30.109.105:8443<http://9.30.109.105:8443>
Origin:https://9.30.109.105:8443
Pragma:no-cache
Sec-WebSocket-Extensions:permessage-deflate; client_max_window_bits
Sec-WebSocket-Key:gUYyWYAMCa6JbnJ4jNiVhA==
Sec-WebSocket-Version:13
Upgrade:websocket
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36


How can I configure knox websocket service to pass the cookies? Thanks in advance.




Re: 答复: How to pass cookie to websocket backend in knox 0.11.0

Posted by Sandeep More <mo...@gmail.com>.
Hello Li,

This is interesting use case, can you elaborate more on it ?

You are right, currently we do not have the ability to rewrite Websocket
urls, we started off with Zeppelin usecase which was basic Websocket
support and are planning to expand the functionality more as we encounter
usecases (like the one that you described)

These usecases are extremely helpful for us know what the community would
like to have, so thanks for bringing this up ! If you could open a JIRA and
describe the usecase there that would be much appreciated and we can then
try to get it in Knox as soon as we can.

Best,
Sandeep

On Mon, Feb 27, 2017 at 8:42 PM, Li Zhou <un...@hotmail.com> wrote:

> Hi, Sandeep:
>
>      Sure, I will open it later. Beside the cookie issue, I also noticed
> knox websocket service doesn't support url rewrite, which means I need
> defined multiple services for multiple socket entries. In my case, I want
> to use /gateway/default/message-service/messages as my socket backend,
> and use extra path as namespace and query parameters to control code flow.
> I noticed the route rewrite doesn't work at all. I think this is also a
> common requirement.
>
>
>     Regards, Li.
>
>
>
> ------------------------------
> *发件人:* Sandeep More <mo...@gmail.com>
> *发送时间:* 2017年2月27日 20:04:47
> *收件人:* user@knox.apache.org
> *主题:* Re: How to pass cookie to websocket backend in knox 0.11.0
>
> Hello Li,
>
> That's a good question, I don't think Knox currently passes session data
> around, can you open up a JIRA I'll take a look at it.
>
> Best,
> Sandeep
>
> On Sun, Feb 26, 2017 at 9:54 PM, Li Zhou <un...@hotmail.com> wrote:
>
>> Hi, guys:
>>
>>     I have a web application with websocket, I'm using knox to proxy the
>> app, have 2 services, one for http, and the other for websocket. But seems
>> the websocket can't get the value JSESSIONID in cookie from the knox, I
>> checked in the browser, it did send cookie correctly. The request from
>> browser shows as below, but after knox proxy, I can't get the cookies.
>>
>>
>> Request URL:wss://9.30.109.105:8443/gateway/default/message-service/
>> messages/topic?name=sqlEditor
>> Request Method:GET
>> Status Code:101 Switching Protocols
>>
>> Response Headers
>> view source
>> Connection:Upgrade
>> Date:Mon, 27 Feb 2017 02:11:29 GMT
>> Sec-WebSocket-Accept:KPpUPgOW3IZT9M9KlxRAn7JVBYQ=
>> Upgrade:WebSocket
>>
>> Request Headers
>> view source
>> Accept-Encoding:gzip, deflate, sdch, br
>> Accept-Language:zh-CN,zh;q=0.8
>> Authorization:Basic YWRtaW46YWRtaW4tcGFzc3dvcmQ=
>> Cache-Control:no-cache
>> Connection:Upgrade
>> Cookie:JSESSIONID=1balehb45f8z91drorxev1om1d
>> Host:9.30.109.105:8443
>> Origin:https://9.30.109.105:8443
>> Pragma:no-cache
>> Sec-WebSocket-Extensions:permessage-deflate; client_max_window_bits
>> Sec-WebSocket-Key:gUYyWYAMCa6JbnJ4jNiVhA==
>> Sec-WebSocket-Version:13
>> Upgrade:websocket
>> User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,
>> like Gecko) Chrome/55.0.2883.87 Safari/537.36
>>
>> How can I configure knox websocket service to pass the cookies? Thanks in
>> advance.
>>
>>
>>
>

答复: How to pass cookie to websocket backend in knox 0.11.0

Posted by Li Zhou <un...@hotmail.com>.
Hi, Sandeep:

     Sure, I will open it later. Beside the cookie issue, I also noticed knox websocket service doesn't support url rewrite, which means I need defined multiple services for multiple socket entries. In my case, I want to use /gateway/default/message-service/messages as my socket backend, and use extra path as namespace and query parameters to control code flow. I noticed the route rewrite doesn't work at all. I think this is also a common requirement.


    Regards, Li.




________________________________
发件人: Sandeep More <mo...@gmail.com>
发送时间: 2017年2月27日 20:04:47
收件人: user@knox.apache.org
主题: Re: How to pass cookie to websocket backend in knox 0.11.0

Hello Li,

That's a good question, I don't think Knox currently passes session data around, can you open up a JIRA I'll take a look at it.

Best,
Sandeep

On Sun, Feb 26, 2017 at 9:54 PM, Li Zhou <un...@hotmail.com>> wrote:

Hi, guys:

    I have a web application with websocket, I'm using knox to proxy the app, have 2 services, one for http, and the other for websocket. But seems the websocket can't get the value JSESSIONID in cookie from the knox, I checked in the browser, it did send cookie correctly. The request from browser shows as below, but after knox proxy, I can't get the cookies.


Request URL:wss://9.30.109.105:8443/gateway/default/message-service/messages/topic?name=sqlEditor<http://9.30.109.105:8443/gateway/default/message-service/messages/topic?name=sqlEditor>
Request Method:GET
Status Code:101 Switching Protocols

Response Headers
view source
Connection:Upgrade
Date:Mon, 27 Feb 2017 02:11:29 GMT
Sec-WebSocket-Accept:KPpUPgOW3IZT9M9KlxRAn7JVBYQ=
Upgrade:WebSocket

Request Headers
view source
Accept-Encoding:gzip, deflate, sdch, br
Accept-Language:zh-CN,zh;q=0.8
Authorization:Basic YWRtaW46YWRtaW4tcGFzc3dvcmQ=
Cache-Control:no-cache
Connection:Upgrade
Cookie:JSESSIONID=1balehb45f8z91drorxev1om1d
Host:9.30.109.105:8443<http://9.30.109.105:8443>
Origin:https://9.30.109.105:8443
Pragma:no-cache
Sec-WebSocket-Extensions:permessage-deflate; client_max_window_bits
Sec-WebSocket-Key:gUYyWYAMCa6JbnJ4jNiVhA==
Sec-WebSocket-Version:13
Upgrade:websocket
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36


How can I configure knox websocket service to pass the cookies? Thanks in advance.



Re: How to pass cookie to websocket backend in knox 0.11.0

Posted by Sandeep More <mo...@gmail.com>.
Hello Li,

That's a good question, I don't think Knox currently passes session data
around, can you open up a JIRA I'll take a look at it.

Best,
Sandeep

On Sun, Feb 26, 2017 at 9:54 PM, Li Zhou <un...@hotmail.com> wrote:

> Hi, guys:
>
>     I have a web application with websocket, I'm using knox to proxy the
> app, have 2 services, one for http, and the other for websocket. But seems
> the websocket can't get the value JSESSIONID in cookie from the knox, I
> checked in the browser, it did send cookie correctly. The request from
> browser shows as below, but after knox proxy, I can't get the cookies.
>
>
> Request URL:wss://9.30.109.105:8443/gateway/default/message-
> service/messages/topic?name=sqlEditor
> Request Method:GET
> Status Code:101 Switching Protocols
>
> Response Headers
> view source
> Connection:Upgrade
> Date:Mon, 27 Feb 2017 02:11:29 GMT
> Sec-WebSocket-Accept:KPpUPgOW3IZT9M9KlxRAn7JVBYQ=
> Upgrade:WebSocket
>
> Request Headers
> view source
> Accept-Encoding:gzip, deflate, sdch, br
> Accept-Language:zh-CN,zh;q=0.8
> Authorization:Basic YWRtaW46YWRtaW4tcGFzc3dvcmQ=
> Cache-Control:no-cache
> Connection:Upgrade
> Cookie:JSESSIONID=1balehb45f8z91drorxev1om1d
> Host:9.30.109.105:8443
> Origin:https://9.30.109.105:8443
> Pragma:no-cache
> Sec-WebSocket-Extensions:permessage-deflate; client_max_window_bits
> Sec-WebSocket-Key:gUYyWYAMCa6JbnJ4jNiVhA==
> Sec-WebSocket-Version:13
> Upgrade:websocket
> User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,
> like Gecko) Chrome/55.0.2883.87 Safari/537.36
>
> How can I configure knox websocket service to pass the cookies? Thanks in
> advance.
>
>
>