Skip to content

Commit

Permalink
Try enable forward headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Layoric committed Nov 20, 2024
1 parent 143917b commit 3ef1b69
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions MyApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@
using MyApp.Data;
using ServiceStack.Blazor;
using System.Net;
using Microsoft.AspNetCore.HttpOverrides;
using MyApp.ServiceInterface;

var builder = WebApplication.CreateBuilder(args);

var services = builder.Services;
var config = builder.Configuration;

services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders =
ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
});

// Add services to the container.
services.AddRazorComponents()
.AddInteractiveServerComponents()
Expand Down Expand Up @@ -65,6 +72,7 @@
else
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
app.UseForwardedHeaders();
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
Expand Down

0 comments on commit 3ef1b69

Please sign in to comment.