Skip to content

Commit

Permalink
force https scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Nov 20, 2024
1 parent 70883b6 commit 3806bfc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 2 additions & 4 deletions MyApp.Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
builder.Services.AddCascadingAuthenticationState();
builder.Services.AddSingleton<AuthenticationStateProvider, PersistentAuthenticationStateProvider>();

var baseUrl = "https://blazor-wasm.web-templates.io";

// Use / for local or CDN resources
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(baseUrl) });
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

var apiBaseUrl = builder.Configuration["ApiBaseUrl"] ?? builder.HostEnvironment.BaseAddress;
builder.Services.AddBlazorApiClient(baseUrl);
builder.Services.AddBlazorApiClient(apiBaseUrl);
builder.Services.AddLocalStorage();

await builder.Build().RunAsync();
5 changes: 5 additions & 0 deletions MyApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
services.AddServiceStack(typeof(MyServices).Assembly);

var app = builder.Build();
app.Use((context, next) =>
{
context.Request.Scheme = "https";
return next(context);
});

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
Expand Down

0 comments on commit 3806bfc

Please sign in to comment.