Unreal Engine HTTP Server Only Works on Localhost (Cannot Bind to LAN IP)

Hello friends,

I’m trying to run an HTTP server in my Unreal Engine (UE 4.27) app, but I’m struggling with an issue. I would be really grateful for any advice or suggestions on how to resolve this!

Thanks in advance!

Issue:

I am trying to set up an HTTP server in Unreal Engine (UE 4.27) to listen for requests on both localhost and my LAN IP (192.168.x.x). The server works perfectly when accessed via localhost, but it fails when using the LAN IP from another device on the same network.

Code:

void AServer::StartServer()
{
if (!FModuleManager::Get().IsModuleLoaded(“HttpServer”))
{
FModuleManager::Get().LoadModule(“HttpServer”);
}

FHttpServerModule& HttpServer = FHttpServerModule::Get();


TSharedPtr<IHttpRouter> Router = HttpServer.GetHttpRouter(8081);

if (Router.IsValid())
{

    
    

    Teleport1RouteHandle = Router->BindRoute(FHttpPath("/teleport1"), EHttpServerRequestVerbs::VERB_GET,
        [this](const FHttpServerRequest& Request, const FHttpResultCallback& OnComplete)
        {
            return HandleRequest(Request, OnComplete, "Teleport1Event");
        });

    Teleport2RouteHandle = Router->BindRoute(FHttpPath("/teleport2"), EHttpServerRequestVerbs::VERB_POST,
        [this](const FHttpServerRequest& Request, const FHttpResultCallback& OnComplete)
        {
            return HandleRequest(Request, OnComplete, "Teleport2Event");
        });

    Teleport3RouteHandle = Router->BindRoute(FHttpPath("/teleport3"), EHttpServerRequestVerbs::VERB_POST,
        [this](const FHttpServerRequest& Request, const FHttpResultCallback& OnComplete)
        {
            return HandleRequest(Request, OnComplete, "Teleport3Event");
        });

    if (Teleport1RouteHandle.IsValid())
    {
        UE_LOG(LogTemp, Log, TEXT("Route /teleport1 successfully bound"));
    }
    else
    {
        Bug = true;
    }

    HttpServer.StartAllListeners();
    
   
    Running = true;
}
else {
    Bug = true;
}

}