我在 Heroku 中托管了示例服务器端 Blazor 应用程序。
https://blazor-server.herokuapp.com
在页面之间切换时,它默认为页面的 http 版本,因此会出现如下错误:
blazor.server.js:8 Uncaught (in promise) Error: System.ArgumentException: The URI 'https://blazor-server.herokuapp.com/counter' is not contained by the base URI 'http://blazor-server.herokuapp.com/'.
最佳答案
将以下命令添加到配置方法似乎已经解决了这个问题:
app.UseForwardedHeaders();
app.Use((ctx, next) =>
{
ctx.Request.Scheme = "https";
return next();
});
关于.net - Blazor BaseURI http 与 https 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56543018/