[hg] galaxy 1694: Allow upstream proxy to set wsgi.url_scheme, s...
details: http://www.bx.psu.edu/hg/galaxy/rev/58744d4bda7b changeset: 1694:58744d4bda7b user: Nate Coraor <nate@bx.psu.edu> date: Fri Jan 09 14:07:16 2009 -0500 description: Allow upstream proxy to set wsgi.url_scheme, so link generation is correct if the proxy uses a different transport with clients than it does with Galaxy. This doesn't work automatically. In Apache, you'd need to set the header yourself: RequestHeader set X-URL-SCHEME https For a discussion on how this affects links to the UCSC Genome Browser, see: http://mail.bx.psu.edu/pipermail/galaxy-user/2009-January/000430.html 2 file(s) affected in this change: lib/galaxy/web/framework/middleware/remoteuser.py lib/galaxy/web/framework/middleware/xforwardedhost.py diffs (25 lines): diff -r 4c1d1ce9265f -r 58744d4bda7b lib/galaxy/web/framework/middleware/remoteuser.py --- a/lib/galaxy/web/framework/middleware/remoteuser.py Thu Jan 08 11:04:19 2009 -0500 +++ b/lib/galaxy/web/framework/middleware/remoteuser.py Fri Jan 09 14:07:16 2009 -0500 @@ -62,6 +62,7 @@ # in the event of a lookup failure, deny access host = None if host in UCSC_SERVERS: + environ[ 'HTTP_REMOTE_USER' ] = 'ucsc_browser_display@example.org' return self.app( environ, start_response ) # Apache sets REMOTE_USER to the string '(null)' when using the # Rewrite* method for passing REMOTE_USER and a user is diff -r 4c1d1ce9265f -r 58744d4bda7b lib/galaxy/web/framework/middleware/xforwardedhost.py --- a/lib/galaxy/web/framework/middleware/xforwardedhost.py Thu Jan 08 11:04:19 2009 -0500 +++ b/lib/galaxy/web/framework/middleware/xforwardedhost.py Fri Jan 09 14:07:16 2009 -0500 @@ -14,4 +14,8 @@ if x_forwarded_for: environ[ 'ORGINAL_REMOTE_ADDR' ] = environ[ 'REMOTE_ADDR' ] environ[ 'REMOTE_ADDR' ] = x_forwarded_for - return self.app( environ, start_response ) \ No newline at end of file + x_url_scheme = environ.get( 'HTTP_X_URL_SCHEME', None ) + if x_url_scheme: + environ[ 'original_wsgi.url_scheme' ] = environ[ 'wsgi.url_scheme' ] + environ[ 'wsgi.url_scheme' ] = x_url_scheme + return self.app( environ, start_response )
participants (1)
-
Nate Coraor