drupflare/worker - v1.0.4
    Preparing search index...

    Function siteFromHost

    • A site id derived from a request host, or undefined when the host names no site. Under keep a non-default port is part of the identity and example.com:443 is example.com; under strip no port is.

      Parameters

      • host: string

        url.host, so a port is already present when there is one

      • protocol: string = 'https:'
      • ports: "keep" | "strip" = 'keep'

        SITE_ID_PORTS: keep for a node that serves sites on different ports, strip where the platform proxies extra ports to one hostname

      Returns string | undefined

      a lowercase id safe as a Durable Object name, or undefined for a local host