mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-17 15:03:02 +00:00
only start ?redirects counter if we are starting from a /user/:name -> /hub/user/:name redirect
This commit is contained in:
@@ -1377,6 +1377,7 @@ class UserUrlHandler(BaseHandler):
|
|||||||
if self.subdomain_host:
|
if self.subdomain_host:
|
||||||
target = user.host + target
|
target = user.host + target
|
||||||
|
|
||||||
|
referer = self.request.headers.get('Referer', '')
|
||||||
# record redirect count in query parameter
|
# record redirect count in query parameter
|
||||||
if redirects:
|
if redirects:
|
||||||
self.log.warning("Redirect loop detected on %s", self.request.uri)
|
self.log.warning("Redirect loop detected on %s", self.request.uri)
|
||||||
@@ -1388,7 +1389,8 @@ class UserUrlHandler(BaseHandler):
|
|||||||
query_parts['redirects'] = redirects + 1
|
query_parts['redirects'] = redirects + 1
|
||||||
url_parts = url_parts._replace(query=urlencode(query_parts, doseq=True))
|
url_parts = url_parts._replace(query=urlencode(query_parts, doseq=True))
|
||||||
target = urlunparse(url_parts)
|
target = urlunparse(url_parts)
|
||||||
else:
|
elif '/user/' in referer:
|
||||||
|
# add first counter only if it's a redirect from /user/:name -> /hub/user/:name
|
||||||
target = url_concat(target, {'redirects': 1})
|
target = url_concat(target, {'redirects': 1})
|
||||||
|
|
||||||
self.redirect(target)
|
self.redirect(target)
|
||||||
|
Reference in New Issue
Block a user