IProxySettings Interface
Defines settings for operating an HTTP service behind a reverse proxy.
public interface IProxySettingsRemarks
Section titled “Remarks”When a service is deployed behind a reverse proxy (such as nginx or IIS ARR), the proxy typically
sets X-Forwarded-* headers that the service must interpret. This interface captures the
path base rewriting and ForwardedHeadersOptions needed to correctly resolve
client addresses, protocols and host names.
Properties
Section titled “Properties”IProxySettings.Defaults Property
Section titled “IProxySettings.Defaults Property”Gets the default proxy settings with no path base and forwarded headers disabled.
static HAKOM.Http.Core.Net.Api.IProxySettings Defaults { get; }Property Value
Section titled “Property Value”IProxySettings.ForwardedHeadersOptions Property
Section titled “IProxySettings.ForwardedHeadersOptions Property”Gets the ForwardedHeadersOptions that control how X-Forwarded-* headers are processed.
Microsoft.AspNetCore.Builder.ForwardedHeadersOptions ForwardedHeadersOptions { get; }Property Value
Section titled “Property Value”Microsoft.AspNetCore.Builder.ForwardedHeadersOptions
IProxySettings.Key Property
Section titled “IProxySettings.Key Property”The configuration key under which proxy settings are expected.
static string Key { get; }Property Value
Section titled “Property Value”IProxySettings.PathBase Property
Section titled “IProxySettings.PathBase Property”Gets an optional path base that the reverse proxy strips before forwarding the request.
string? PathBase { get; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”When set, the service will prepend this value to Microsoft.AspNetCore.Http.HttpRequest.PathBase so that URLs generated by the application match the externally visible paths.
Methods
Section titled “Methods”IProxySettings.TryRead(IConfiguration) Method
Section titled “IProxySettings.TryRead(IConfiguration) Method”Attempts to read proxy settings from the specified configuration.
static HAKOM.ErrorHandling.Core.Net.Api.Result<HAKOM.Http.Core.Net.Api.IProxySettings> TryRead(Microsoft.Extensions.Configuration.IConfiguration configuration);Parameters
Section titled “Parameters”configuration Microsoft.Extensions.Configuration.IConfiguration
The Microsoft.Extensions.Configuration.IConfiguration to read from.
Returns
Section titled “Returns”HAKOM.ErrorHandling.Core.Net.Api.Result<IProxySettings>
A Result<TValue> containing the parsed IProxySettings.