Skip to content

Commit 7661369

Browse files
committed
Make the proxy ip more robust ™️
1 parent 183b374 commit 7661369

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ReplayBrowser/Startup.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,15 @@ public void ConfigureServices(IServiceCollection services)
9393
services.Configure<ForwardedHeadersOptions>(options =>
9494
{
9595
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
96-
options.KnownProxies.Add(IPAddress.Parse(Configuration["ProxyIP"]));
96+
var proxyIP = Configuration["ProxyIP"];
97+
if (proxyIP == null)
98+
{
99+
Log.Fatal("No proxy IP found in appsettings.json. Exiting.");
100+
Environment.Exit(1);
101+
}
102+
103+
Log.Information("Proxy IP: {ProxyIP}", proxyIP);
104+
options.KnownProxies.Add(IPAddress.Parse(proxyIP));
97105
});
98106

99107
services.AddOpenTelemetry().WithMetrics(providerBuilder =>

0 commit comments

Comments
 (0)