Perhaps not the answer to the OP's situation, but I experienced the same issue recently and after digging around for ages, the problem was that Firefox needed to be granted Local Network permissions in macOS Settings > Privacy & Security. Sigh.