mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-14 13:33:00 +00:00
Update app.bind_url and proxy.public_url when (external) SSL is enabled
This commit is contained in:

committed by
Bruno P. Kinoshita

parent
06da90ac76
commit
76afec8adb
@@ -576,6 +576,22 @@ class JupyterHub(Application):
|
||||
""",
|
||||
).tag(config=True)
|
||||
|
||||
@validate('bind_url')
|
||||
def _validate_bind_url(self, proposal):
|
||||
"""ensure protocol field of bind_url matches ssl"""
|
||||
v = proposal['value']
|
||||
proto, sep, rest = v.partition('://')
|
||||
if self.ssl_cert and proto != 'https':
|
||||
return 'https' + sep + rest
|
||||
elif proto != 'http' and not self.ssl_cert:
|
||||
return 'http' + sep + rest
|
||||
return v
|
||||
|
||||
@default('bind_url')
|
||||
def _bind_url_default(self):
|
||||
proto = 'https' if self.ssl_cert else 'http'
|
||||
return proto + '://:8000'
|
||||
|
||||
subdomain_host = Unicode(
|
||||
'',
|
||||
help="""Run single-user servers on subdomains of this host.
|
||||
|
Reference in New Issue
Block a user