From 8140219e3251551788f6de23e22a8a413d5106b1 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Mon, 23 Feb 2026 17:48:17 +0100 Subject: made it so HttpServer::GetServiceUri returns an IP instead of the machine name, for better resolution --- src/zenhttp/httpserver.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/zenhttp/httpserver.cpp') diff --git a/src/zenhttp/httpserver.cpp b/src/zenhttp/httpserver.cpp index d6dfb347f..3cefa0ad8 100644 --- a/src/zenhttp/httpserver.cpp +++ b/src/zenhttp/httpserver.cpp @@ -1016,19 +1016,26 @@ int HttpServer::Initialize(int BasePort, std::filesystem::path DataDir) { m_EffectivePort = OnInitialize(BasePort, std::move(DataDir)); + m_ExternalHost = OnGetExternalHost(); return m_EffectivePort; } +std::string +HttpServer::OnGetExternalHost() const +{ + return GetMachineName(); +} + std::string HttpServer::GetServiceUri(const HttpService* Service) const { if (Service) { - return fmt::format("http://{}:{}{}", GetMachineName(), m_EffectivePort, Service->BaseUri()); + return fmt::format("http://{}:{}{}", m_ExternalHost, m_EffectivePort, Service->BaseUri()); } else { - return fmt::format("http://{}:{}", GetMachineName(), m_EffectivePort); + return fmt::format("http://{}:{}", m_ExternalHost, m_EffectivePort); } } -- cgit v1.2.3