Skip to content

Running on https://{ip}:{port}/ message contains a URL that will fail certificate verification and auth #336

Open

Description

@lordmauve

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_path

Expected Behaviour

One or more of:

  • The value of config.bind is 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:

await config.log.info(f"Running on https://{bind} (CTRL + C to quit)")

repr_socket_addr() always gives a raw network address:

def repr_socket_addr(family: int, address: tuple) -> str:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions