Jupyterhub with subdomains: escaping usernames

I’m trying to set up a jupyterhub with subdomains for extra security (preparing for the RTC :tada:). I have configured c.JupyterHub.subdomain_host = "https://{{ jupyterhub_hostname }}", wildcard DNS and SSL and everything worked out great… until a user with a dot in a username showed up, let’s say anton.akhmerov. That user gets a sub-subdomain anton.akhmerov.jupyterhub.tld, which has no certificate. Is there a known workaround? In case it’s relevant, I’m running jupyterhub 3.1.0.

EDIT it seems it’s a known issue (see snippet below); any suggestions for a workaround?

I have fixed this by monkey-patching

jupyterhub.user._dns_needs_replace = set(string.ascii_letters + string.digits + '-%')

in jupyterhub_config.py.

I’ve opened the issue below: