Adds ForwardedHeaders and debug endpoint
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
All checks were successful
Build, Push and Run Container / build (push) Successful in 25s
Adds ForwardedHeaders to handle reverse proxy scenarios. Adds a debug endpoint to display the correct scheme and host when running behind a reverse proxy, aiding in debugging authentication issues.
This commit is contained in:
@@ -94,6 +94,8 @@ builder.Services.AddHostedService<MQTTClient>();
|
||||
//Build app
|
||||
WebApplication app = builder.Build();
|
||||
|
||||
app.UseForwardedHeaders();
|
||||
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.MapOpenApi();
|
||||
@@ -133,6 +135,13 @@ if (app.Environment.IsDevelopment())
|
||||
ExpiresAtRaw = expiresAtRaw
|
||||
});
|
||||
});
|
||||
app.MapGet("DebugProxy", (IHttpContextAccessor httpContextAccessor) =>
|
||||
{
|
||||
var ctx = httpContextAccessor.HttpContext!;
|
||||
var request = ctx.Request;
|
||||
|
||||
return $"{request.Scheme}://{request.Host}/token-exchange";
|
||||
});
|
||||
}
|
||||
|
||||
//Map static assets
|
||||
|
||||
Reference in New Issue
Block a user