-
Notifications
You must be signed in to change notification settings - Fork 134
Open
Description
After hypercorn starts it logs a message
[2025-12-08 17:13:04 +0000] [3686850] [INFO] Running on https://172.23.219.170:8080 (CTRL + C to quit)
This URL is not usable because the TLS certificates are only valid for the common name I provide in config.bind, not the bound IP address. Therefore clicking this URL shows a certificate error page.
Steps to reproduce
Run hypercorn with
config = hypercorn.config.Config()
config.bind = [f"{socket.getfqdn()}:{PORT}"]
config.keyfile = key_path
config.certfile = cert_pathExpected Behaviour
One or more of:
- The value of
config.bindis used to construct the URL. - Another configuration attribute is available to configure the URL that is printed.
- The message is not formatted like a hyperlink, e.g. "Listening on 172.23.219.170:8080 with TLS".
- The URL is constructed from the CN of the certificate, plus port.
Observed Behaviour
The URL is constructed by calling repr_socket_addr() on the listening socket:
hypercorn/src/hypercorn/trio/run.py
Line 72 in 0e2311f
| await config.log.info(f"Running on https://{bind} (CTRL + C to quit)") |
repr_socket_addr() always gives a raw network address:
hypercorn/src/hypercorn/utils.py
Line 180 in 0e2311f
| def repr_socket_addr(family: int, address: tuple) -> str: |
Metadata
Metadata
Assignees
Labels
No labels