global: add support for specifying known proxies (#63)

* Add KNOWN_PROXIES

* Add known proxy setup in Startup.cs

Refactor forwarded headers configuration to use a variable for options.

* Document KNOWN_PROXIES in .env file

Added documentation for KNOWN_PROXIES environment variable

* Clean up

Restored license comments and formatting in Constants.cs.

* Apply suggestion from @thecodrr

* Added KnownProxies functionality at Streetwriters.Common level

---------

Co-authored-by: Abdullah Atta <thecodrr@protonmail.com>
This commit is contained in:
Tate M Walker
2025-10-29 00:14:49 -05:00
committed by GitHub
parent ab9efaea7f
commit dd05c55875
6 changed files with 39 additions and 23 deletions

View File

@@ -212,14 +212,7 @@ namespace Streetwriters.Identity
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (!env.IsDevelopment())
{
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedForHeaderName = "CF-Connecting-IP",
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
}
app.UseForwardedHeadersWithKnownProxies(env, "CF-Connecting-IP");
app.UseCors("notesnook");
app.UseVersion(Servers.IdentityServer);