APIs have wrong certificate, Blazor website refuses to connect

I have the following setup: One Blazor Server Side Website, an API Gateway using Ocelot and a few Microservices also using All of these things are run in individual Docker Containers.

First of, everything works, the connections work, I can fetch data, but only on http. I have the dev-certs enabled for, and they also "work" but the problem is, they are signed for the wrong host.

When I navigate to a gateway with the browser, it works as long as I call "localhost" and the port. The problem is, because they run in Containers, localhost does not mean the same thing for them. That means I have to use my local IP and the port to send them to the correct service. But the certificate is signed for "localhost" meaning it thinks the cert is invalid because the host is no longer "localhost".

This means that my blazor app sees a certificate that does not match the host and gets an exception because it can’t validate the cert. I looked up a lot of stuff and found nothing, but basically I need a way to either change the certificates in the containers or tell the blazor server to accept those certificates.

I have not found a thing on this topic, so I would really appreciate some help.

Source: StackOverflow