mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-18 07:23:00 +00:00
if no referer is given, assume the worst
only way to avoid redirect loops if referers are not set (e.g. python requests)
This commit is contained in:
@@ -1389,7 +1389,7 @@ 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)
|
||||||
elif '/user/' in referer:
|
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
|
# 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})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user