Skip to content

Commit

Permalink
Add private networks as trusted networks
Browse files Browse the repository at this point in the history
  • Loading branch information
LucHeart committed Sep 27, 2023
1 parent f8b1ef0 commit 6648618
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion API/APIGlobals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ public static class APIGlobals
{
public static ApiConfig ApiConfig = null!;

public static readonly string[] CloudflareProxies =
public static readonly string[] TrustedProxies =
{
"10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16",
// Cloudflare
"103.21.244.0/22", "103.22.200.0/22", "103.31.4.0/22", "104.16.0.0/13", "104.24.0.0/14", "108.162.192.0/18",
"131.0.72.0/22", "141.101.64.0/18", "162.158.0.0/15", "172.64.0.0/13", "173.245.48.0/20", "188.114.96.0/20",
"190.93.240.0/20", "197.234.240.0/22", "198.41.128.0/17", "2400:cb00::/32", "2606:4700::/32", "2803:f800::/32",
Expand Down
2 changes: 1 addition & 1 deletion API/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF
ApplicationLogging.LoggerFactory = loggerFactory;
var logger = ApplicationLogging.CreateLogger<Startup>();
EnvString = env.EnvironmentName;
foreach (var proxy in APIGlobals.CloudflareProxies)
foreach (var proxy in APIGlobals.TrustedProxies)
{
var split = proxy.Split('/');
_forwardedSettings.KnownNetworks.Add(new IPNetwork(IPAddress.Parse(split[0]), int.Parse(split[1])));
Expand Down

0 comments on commit 6648618

Please sign in to comment.