To treat specific hostnames as secure contexts even if the protocol is http Firefox has the dom.securecontext.allowlist about:config preference. It would be great if this setting would also let you narrow down the allowance to a specific port since the https upgrading can easily break other applications. Chromium already has this feature: in its chrome://flags "Insecure origins treated as secure" setting you can specify URLs with ports.
Example use case: accessing a self-hosted web app via a Tailscale VPN when the app depends on a feature only available in secure contexts