-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram.cs
More file actions
36 lines (27 loc) · 1.16 KB
/
Copy pathprogram.cs
File metadata and controls
36 lines (27 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var builder = WebApplication.CreateBuilder(args);
// Remove logging setup entirely
builder.Logging.ClearProviders(); // Clears logging providers without adding Console/Debug
builder.Services.AddReverseProxy()
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"))
.AddConfigFilter<EnvConfigFilter>();
var app = builder.Build();
// Keep middleware in place
app.UseMiddleware<CountryRestrictionMiddleware>();
// Map endpoints without logging
app.MapGet("/instance", () =>
{
string instanceId = Environment.GetEnvironmentVariable("WEBSITE_INSTANCE_ID") ?? "Instance ID not found";
string appName = Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME") ?? "App Name not found";
return Results.Ok(new { source = appName, InstanceId = instanceId });
});
app.MapGet("/show-headers", async (HttpContext context) =>
{
var headers = context.Request.Headers;
return Results.Json(headers); // Returns headers without logging
});
// Map reverse proxy without custom logging in the proxy pipeline
app.MapReverseProxy();
app.Run();