• Rebuilds a url issued by the server against the connection this client actually holds.

    The server composes such urls from its own address and listener and cannot know how the client reached it: the address may be a bare IP, unreachable from another network and rejected by TLS validation, and behind a reverse proxy the listener is plain http on an internal port while the public entry point is https on 443.

    Applied in order:

    • a bare IP host, or the host of the connection itself, is pointed at the connection host; any other named host is left alone, it may be another node on purpose;
    • a connection without an explicit port means a single public entry point, so the url is collapsed onto that origin: scheme from the connection, no port;
    • otherwise scheme and port stay as issued, the server having reported its own listener, except that an https page upgrades a leftover http url, which it would refuse to load anyway.

    Path and query survive every rule, so icon link signatures, which cover the query only, stay valid.

    Parameters

    • url: string
    • connectionUrl: string

    Returns string