Configures forwarded headers for the application
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
Ensures the application correctly handles forwarded headers by explicitly setting the `ForwardedHeaders` option to `ForwardedHeaders.All`. This allows the application to properly determine the client's IP address and other request information when behind a proxy or load balancer.
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Text.Json;
|
|||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
||||||
|
using Microsoft.AspNetCore.HttpOverrides;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
@@ -94,7 +95,7 @@ builder.Services.AddHostedService<MQTTClient>();
|
|||||||
//Build app
|
//Build app
|
||||||
WebApplication app = builder.Build();
|
WebApplication app = builder.Build();
|
||||||
|
|
||||||
app.UseForwardedHeaders();
|
app.UseForwardedHeaders(new ForwardedHeadersOptions() { ForwardedHeaders = ForwardedHeaders.All });
|
||||||
|
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user