From 58d311f2e0044ddfce2c85c63daebebc83016add Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Fri, 22 Feb 2019 12:48:43 -0500 Subject: [PATCH] Make the cookie_path an attribute on trans so that consumers don't need to duplicate logic. Unfortunately it isn't usable for the proxy setup since trans isn't available when the command line is generated. --- .../visualization/plugins/interactive_environments.py | 2 +- lib/galaxy/web/framework/webapp.py | 6 +++++- lib/galaxy/web/proxy/__init__.py | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/visualization/plugins/interactive_environments.py b/lib/galaxy/visualization/plugins/interactive_environments.py index 26571e31d6c..b7c1016f41c 100644 --- a/lib/galaxy/visualization/plugins/interactive_environments.py +++ b/lib/galaxy/visualization/plugins/interactive_environments.py @@ -88,7 +88,7 @@ class InteractiveEnvironmentRequest(object): self.attr.proxy_prefix = '/'.join( ( '', - (self.attr.galaxy_config.cookie_path or '/').strip('/'), + trans.cookie_path.strip('/'), self.attr.galaxy_config.dynamic_proxy_prefix.strip('/'), self.attr.viz_id, ) diff --git a/lib/galaxy/web/framework/webapp.py b/lib/galaxy/web/framework/webapp.py index 2ac12204139..f64e0a1d05b 100644 --- a/lib/galaxy/web/framework/webapp.py +++ b/lib/galaxy/web/framework/webapp.py @@ -620,12 +620,16 @@ class GalaxyWebTransaction(base.DefaultWebTransaction, # self.log_event( "Automatically created account '%s'", user.email ) return user + @property + def cookie_path(self): + return self.app.config.cookie_path or url_for('/') + def __update_session_cookie(self, name='galaxysession'): """ Update the session cookie to match the current session. """ self.set_cookie(self.security.encode_guid(self.galaxy_session.session_key), - name=name, path=self.app.config.cookie_path or url_for('/')) + name=name, path=self.cookie_path) def check_user_library_import_dir(self, user): if getattr(self.app.config, "user_library_import_dir_auto_creation", False): diff --git a/lib/galaxy/web/proxy/__init__.py b/lib/galaxy/web/proxy/__init__.py index 94c73335b2c..15805090159 100644 --- a/lib/galaxy/web/proxy/__init__.py +++ b/lib/galaxy/web/proxy/__init__.py @@ -13,6 +13,7 @@ from galaxy.util import ( ) from galaxy.util.filelock import FileLock from galaxy.util.lazy_process import LazyProcess, NoOpLazyProcess +from galaxy.web.framework import url_for log = logging.getLogger(__name__) @@ -148,7 +149,7 @@ class GolangProxyLauncher(object): config.dynamic_proxy_bind_port, ), "--listenPath", "/".join(( - (config.cookie_path or '/'), + (config.cookie_path or url_for('/')), config.dynamic_proxy_prefix )), "--cookieName", "galaxysession",