Jelle and I have been debugging over IRC, crossposting here for awareness until I can get proper fixes pushed all the right places.

Jelle, like I, have "proper" enterprise deployments. I.e. SSL, galaxy under a proxy-prefix, etc.

galaxy.ini:

  1. galaxy_infrastructure_web_port = 8090
  2. dynamic_proxy_manage=True
  3. dynamic_proxy_session_map=database/session_map.sqlite
  4. dynamic_proxy_bind_port=8800
  5. dynamic_proxy_bind_ip=0.0.0.0
  6. dynamic_proxy_debug=True
  7. dynamic_proxy_external_proxy=True

Apache conf needs to have special routes for the ipython GIE, I've added this to my master GIE planning issue.

  1. RewriteEngine on
  2. RewriteRule ^/galaxy-dev/ipython/(.*) http://localhost:8800/galaxy-dev/ipython/$1 [P]
  3.  
  4. <Location /galaxy-dev/ipython/>
  5. </Location>

Now that all that is set up, until galaxy's interactive_environments.py can be updated, you have to manually correct the URLs from mako:

--- a/config/plugins/interactive_environments/ipython/templates/ipython.mako
+++ b/config/plugins/interactive_environments/ipython/templates/ipython.mako
@@ -36,8 +36,8 @@ else:
 
 ## General IE specific
 # Access URLs for the notebook from within galaxy.
-notebook_access_url = ie_request.url_template('${PROXY_URL}/ipython/${PORT}/notebooks/ipython_galaxy_notebook.ipynb')
-notebook_login_url = ie_request.url_template('${PROXY_URL}/ipython/${PORT}/login?next=%2Fipython%2F${PORT}%2Ftree')
+notebook_access_url = ie_request.url_template('${PROXY_URL}/galaxy-dev/ipython/${PORT}/notebooks/ipython_galaxy_notebook.ipynb')
+notebook_login_url = ie_request.url_template('${PROXY_URL}/galaxy-dev/ipython/${PORT}/login?next=%2Fipython%2F${PORT}%2Ftree')


With this, it's pretty close, however the containers aren't yet aware of the new URL they're to be accessed under:


From 76bf20de305d64e544911a86ea5d0cb03e4281bd Mon Sep 17 00:00:00 2001
From: Eric Rasche <esr@tamu.edu>
Date: Thu, 16 Jul 2015 12:00:47 -0500
Subject: [PATCH] Use galaxy prefix to build a full URL

---
 ipython_notebook_config.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ipython_notebook_config.py b/ipython_notebook_config.py
index 3d9780d..4ec4675 100644
--- a/ipython_notebook_config.py
+++ b/ipython_notebook_config.py
@@ -21,8 +21,9 @@ if os.environ.get('DOCKER_PORT', 'none') == 'none':
     c.NotebookApp.base_url = '/ipython/'
     c.NotebookApp.webapp_settings = {'static_url_prefix': '/ipython/static/'}
 else:
-    c.NotebookApp.base_url = '/ipython/%s/' % os.environ['DOCKER_PORT']
-    c.NotebookApp.webapp_settings = {'static_url_prefix': '/ipython/%s/static/' % os.environ['DOCKER_PORT']}
+    url_base = '%s/ipython/%s/' % ("galaxy-dev", os.environ['DOCKER_PORT'])
+    c.NotebookApp.base_url = url_base
+    c.NotebookApp.webapp_settings = {'static_url_prefix': '%s/static/' % (url_base, os.environ['DOCKER_PORT'])}
 
 if os.environ.get('NOTEBOOK_PASSWORD', 'none') != 'none':
     c.NotebookApp.password = os.environ['NOTEBOOK_PASSWORD']
--
2.3.5



With the above patch applied, and the container rebuilt (remember to specify it in ipython.ini), everything SHOULD work.

This will all be corrected by the next Galaxy release so that containers are automatically aware of proxies, and all of this is handled slightly more sensibly.

Cheers,
Eric

2015-07-15 13:20 GMT-05:00 Eric Rasche <esr@tamu.edu>:
Hi jelle,

Replied to IRC but you disconnected.
  • Do you have dynamic_proxy_external_proxy=True?
  • You may need to set an Origin header, which is technically bad practice, but since the user is validated by the galaxy cookie, it's a bit more acceptable.
I'm on IRC for further debugging if need be.

Cheers,
Eric

2015-07-15 4:47 GMT-05:00 Jelle Scholtalbers <j.scholtalbers@gmail.com>:
Hi Björn, Eric, all,

I'm trying to get ipython running on our instance. Without the proxy, e.g. http://myserver:8080 it works fine. However, with the proxy in front (e.g. http://myserver/galaxy) I get this firefox error
"11:28:37.793 Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://gbcs-dev:8800/ipython/39958/login?next=%2Fipython%2F39958%2Ftree. (Reason: CORS request failed).1 <unknown>"
or on chrome "xhr" request "cancelled".

Do you happen to know the correct apache settings to overcome this?
I tried a few things, but I ended up with ipython starting, but with a message "cannot connect to websocket".

- Jelle

___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  https://lists.galaxyproject.org/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/



--
Eric Rasche
Programmer II

Center for Phage Technology
Rm 312A, BioBio
Texas A&M University
College Station, TX 77843
404-692-2048




--
Eric Rasche
Programmer II

Center for Phage Technology
Rm 312A, BioBio
Texas A&M University
College Station, TX 77843
404-692-2048
esr@tamu.edu
rasche.eric@yandex.ru