tymonello
tymonello
CC#
Created by tymonello on 3/16/2023 in #help
❔ Blazor communicate with WebAPI on localhost server
Hello, I want to start making a staging environment for my application, I got a WebAPI ready and working, and I installed it on a ubuntu server in my local network. But when I am calling it from Blazor, I am getting an Error: System.Net.Http.HttpRequestException: The SSL connection could not be established. It works well when I run both API and Blazor on my computer. I have configured NGINX, I can call the API from a browser, first by IP address, then I added it to a DNS on a local domain, it works like that too. I created a self-signed certificate. Because certbot doesn't work for .local domains and IP addresses. But I somehow can't really make it all work together. Sometimes the API works when I add the port it runs on, so it has no certificate, other times it works via the NGINX, when I just enter the address without ports, and shows the certificate in the browser I created, but Blazor still shows the same error. I probably messed up everything by now, so I am looking for a good guide on how to run an API on a Ubuntu server, so that it is exposed on port 80 and 443, and that Blazor can communicate with it.
10 replies