Skip to content

Commit

Permalink
Add dynamic_proxy_prefix configuration
Browse files Browse the repository at this point in the history
Normally the proxy binds to :8800 and runs containers under
:8800/ipython/... which is great... until you have an upstream proxy
like apache wrapping that at the url FQDN/ipython and suddenly your
cookies aren't available because they're specific to /galaxy.

Thus, when an upstream proxy is in use, we correct the proxy's path to:
with :8800/{cookie_path}/gie_proxy/ipython/... which behaves much more
nicely with upstraem proxies.
  • Loading branch information
hexylena committed Sep 23, 2015
1 parent a76ba39 commit 06a67c8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions config/galaxy.ini.sample
Expand Up @@ -574,6 +574,12 @@ nglims_config_file = tool-data/nglims.yaml
# nodejs to wrap connections in SSL).
#dynamic_proxy_external_proxy=False

# Additionally, when the dynamic proxy is proxied by an upstream server, you'll
# want to specify a prefixed URL so both Galaxy and the proxy reside under the
# same path that your cookies are under. This will result in a url like
# https://FQDN/galaxy-prefix/gie_proxy for proxying
#dynamic_proxy_prefix=gie_proxy

# -- Logging and Debugging

# If True, Galaxy will attempt to configure a simple root logger if a
Expand Down
1 change: 1 addition & 0 deletions lib/galaxy/config.py
Expand Up @@ -443,6 +443,7 @@ def __init__( self, **kwargs ):
self.dynamic_proxy_bind_port = int( kwargs.get( "dynamic_proxy_bind_port", "8800" ) )
self.dynamic_proxy_bind_ip = kwargs.get( "dynamic_proxy_bind_ip", "0.0.0.0" )
self.dynamic_proxy_external_proxy = string_as_bool( kwargs.get( "dynamic_proxy_external_proxy", "False" ) )
self.dynamic_proxy_prefix = kwargs.get( "dynamic_proxy_prefix", "gie_proxy" )

# Default chunk size for chunkable datatypes -- 64k
self.display_chunk_size = int( kwargs.get( 'display_chunk_size', 65536) )
Expand Down
8 changes: 5 additions & 3 deletions lib/galaxy/web/proxy/__init__.py
Expand Up @@ -17,7 +17,9 @@
class ProxyManager(object):

def __init__( self, config ):
for option in [ "manage_dynamic_proxy", "dynamic_proxy_bind_port", "dynamic_proxy_bind_ip", "dynamic_proxy_debug", "dynamic_proxy_external_proxy" ]:
for option in ["manage_dynamic_proxy", "dynamic_proxy_bind_port",
"dynamic_proxy_bind_ip", "dynamic_proxy_debug",
"dynamic_proxy_external_proxy", "dynamic_proxy_prefix"]:
setattr( self, option, getattr( config, option ) )
self.launch_by = "node" # TODO: Support docker
if self.manage_dynamic_proxy:
Expand All @@ -44,9 +46,9 @@ def setup_proxy( self, trans, host=DEFAULT_PROXY_TO_HOST, port=None ):
host = host[0:host.index(':')]
scheme = trans.request.scheme
if not self.dynamic_proxy_external_proxy:
proxy_url = '%s://%s:%d' % (scheme, host, self.dynamic_proxy_bind_port)
proxy_url = '%s://%s:%d/%s' % (scheme, host, self.dynamic_proxy_bind_port, self.dynamic_proxy_prefix)
else:
proxy_url = '%s://%s' % (scheme, host)
proxy_url = '%s://%s/%s' % (scheme, host, self.dynamic_proxy_prefix)
return {
'proxy_url': proxy_url,
'proxied_port': proxy_requests.port,
Expand Down

0 comments on commit 06a67c8

Please sign in to comment.