Return the application builder after applying proxy hosting
This commit is contained in:
@@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.Builder
|
|||||||
/// <param name="app">The application builder.</param>
|
/// <param name="app">The application builder.</param>
|
||||||
/// <param name="network">The <see cref="IPNetwork"/> where proxy requests are received from (optional).</param>
|
/// <param name="network">The <see cref="IPNetwork"/> where proxy requests are received from (optional).</param>
|
||||||
/// <param name="address">The <see cref="IPAddress"/> where proxy requests are received from (optional).</param>
|
/// <param name="address">The <see cref="IPAddress"/> where proxy requests are received from (optional).</param>
|
||||||
public static void UseProxyHosting(this IApplicationBuilder app, IPNetwork network = null, IPAddress address = null)
|
public static IApplicationBuilder UseProxyHosting(this IApplicationBuilder app, IPNetwork network = null, IPAddress address = null)
|
||||||
{
|
{
|
||||||
string path = Environment.GetEnvironmentVariable("ASPNETCORE_APPL_PATH");
|
string path = Environment.GetEnvironmentVariable("ASPNETCORE_APPL_PATH");
|
||||||
if (!string.IsNullOrWhiteSpace(path))
|
if (!string.IsNullOrWhiteSpace(path))
|
||||||
@@ -64,6 +64,8 @@ namespace Microsoft.AspNetCore.Builder
|
|||||||
options.KnownProxies.Add(address);
|
options.KnownProxies.Add(address);
|
||||||
|
|
||||||
app.UseForwardedHeaders(options);
|
app.UseForwardedHeaders(options);
|
||||||
|
|
||||||
|
return app;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user