mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-16 22:43:00 +00:00
Merge master into rbac
This commit is contained in:
@@ -1604,7 +1604,6 @@ class UserUrlHandler(BaseHandler):
|
||||
if self.subdomain_host:
|
||||
target = user.host + target
|
||||
|
||||
referer = self.request.headers.get('Referer', '')
|
||||
# record redirect count in query parameter
|
||||
if redirects:
|
||||
self.log.warning("Redirect loop detected on %s", self.request.uri)
|
||||
@@ -1616,8 +1615,12 @@ class UserUrlHandler(BaseHandler):
|
||||
query_parts['redirects'] = redirects + 1
|
||||
url_parts = url_parts._replace(query=urlencode(query_parts, doseq=True))
|
||||
target = urlunparse(url_parts)
|
||||
elif '/user/{}'.format(user.name) in referer or not referer:
|
||||
# add first counter only if it's a redirect from /user/:name -> /hub/user/:name
|
||||
else:
|
||||
# Start redirect counter.
|
||||
# This should only occur for redirects from /user/:name -> /hub/user/:name
|
||||
# when the corresponding server is already ready.
|
||||
# We don't check this explicitly (direct visits to /hub/user are technically possible),
|
||||
# but that's now the only normal way to get here.
|
||||
target = url_concat(target, {'redirects': 1})
|
||||
|
||||
self.redirect(target)
|
||||
|
Reference in New Issue
Block a user