JAG
JAG

Reputation: 685

Blazor BaseURI http vs https issue

I have the sample serverside Blazor app hosted in Heroku.

https://blazor-server.herokuapp.com

When switching between pages it defaults to the http version of the page, therefore giving me errors like this:

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/'.

Upvotes: 2

Views: 2050

Answers (1)

JAG
JAG

Reputation: 685

adding the following commands to the Configure method seems to have resolved it:

  app.UseForwardedHeaders();
    app.Use((ctx, next) =>
    {
        ctx.Request.Scheme = "https";
        return next();
    });

Upvotes: 3

Related Questions