switch default ws_url logic to js side#3307
Conversation
|
Tested using nginx as a HTTPS reverse-proxy for a HTTP ipython notebook server and it all seems to work fine. I haven't done particularly extensive testing, but I can edit and execute code successfully. |
|
Looks fine to me, but need rebase right now. Will probably also conflict with @ellisonbg refactor of JS. |
|
almost certainly - I will rebase after that one gets merged. |
In some cases (proxies, ipython#3305), the request object doesn't have the right information about the originating information. This changes the default behavior, so that `ws_url` is generally empty by default, which the javascript takes to mean 'the same as http'. This is simpler and should be more resilient than trying a guess on server-side.
Rather than specifying only the hostname, it makes much more sense to specify the whole protocol,host,port in a single go.
|
rebased |
|
+1 |
|
Merging soon if no objections. |
|
Oups, I forgot to merge this one. Something wrong we are dangerously approaching <10 opened PRs... |
switch default ws_url logic to js side In some cases (proxies, #3305), the request object doesn't have the right information about the originating information. This changes the default behavior, so that ws_url is generally empty by default, which the javascript takes to mean 'the same as http'. This is simpler and should be more resilient than trying a guess on server-side. also replaces unused websocket_host with websocket_url Rather than specifying only the hostname, it makes much more sense to specify the whole protocol,host,port in a single go.
|
It would be nice if Dev: URL mapping of IPython notebook were included in sphinx document, had more specific document about JSON content, and updated when this patch is applied. It causes a problem in Emacs client and I needed sometime to figure out what's going wrong. Of course you don't need care about Emacs client, but documenting this kind of stuff makes project better, I think. |
There was a problem hiding this comment.
I am 90% sure this is a dumb question, but can't location.origin start with "https"?
There was a problem hiding this comment.
yes - this will turn http:// into ws:// and https:// into wss://, which is how you specify "websocket over https"
There was a problem hiding this comment.
Ah, I see. You are using s from https.
|
Just to pitch un à little late, sorry @tkf, I would have seen this would Le lundi 10 juin 2013, Takafumi Arakaki a écrit :
|
|
@Carreau Thanks, pinging me when there is major JS kernel change would be great. I guess it would be nice if automated test can be hooked to upstream change in Travis. But I guess that require changing .travis.yml in IPython and won't scale as there are many IPython-related projects. I am thinking to setup a cron job to watch IPython change. Regarding the document I opened an issue: #3417 |
switch default ws_url logic to js side In some cases (proxies, ipython#3305), the request object doesn't have the right information about the originating information. This changes the default behavior, so that ws_url is generally empty by default, which the javascript takes to mean 'the same as http'. This is simpler and should be more resilient than trying a guess on server-side. also replaces unused websocket_host with websocket_url Rather than specifying only the hostname, it makes much more sense to specify the whole protocol,host,port in a single go.
IPython notebook 1.0.dev sends empty ws_url as of this PR ipython/ipython#3307
In some cases (proxies, #3305), the request object doesn't have the right information about the originating information. This changes the default behavior, so that
ws_urlis generally empty by default, which the javascript takes to mean 'the same as http'. This is simpler and should be more resilient than trying a guess on server-side.also replaces unused
websocket_hostwithwebsocket_urlRather than specifying only the hostname, it makes much more sense to specify the whole protocol,host,port in a single go.