Dynamically populate LocalAddress based on HTTP request

Support populating the LocalAddress field in the system info
endpoint based on the x-forwarded-host and x-forwarded-proto header.

The x-forwarded-host header must contain both the host and port for
the url to be properly constructed.

Behind network configuration option that is disabled by default.
This commit is contained in:
Fredrik Lindberg
2021-08-31 22:22:55 +02:00
parent e15fea5dad
commit 90174f68e2
5 changed files with 29 additions and 11 deletions

View File

@@ -66,7 +66,7 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
public ActionResult<SystemInfo> GetSystemInfo()
{
return _appHost.GetSystemInfo(Request.HttpContext.Connection.RemoteIpAddress ?? IPAddress.Loopback);
return _appHost.GetSystemInfo(Request);
}
/// <summary>
@@ -78,7 +78,7 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
public ActionResult<PublicSystemInfo> GetPublicSystemInfo()
{
return _appHost.GetPublicSystemInfo(Request.HttpContext.Connection.RemoteIpAddress ?? IPAddress.Loopback);
return _appHost.GetPublicSystemInfo(Request);
}
/// <summary>