#3180·actix-web

Multiple services over multiple sockets example creates an incorrect AppConfig

Author: pjenveyCreated Oct 30, 2023Updated Sep 14, 2026
LabelsA-web

Per conversations on the discord, the most idiomatic way to spawn multiple services over multiple sockets is by following the current actix-http example using actix_server::Server.

This is preferred over the alternative of spawning more than one HttpServer as that results in each HttpServer spawning exclusive threads for themselves (e.g. 2 of them would spawn n*2 threads, where n is number of physical cores).

Expected Behavior

Current Behavior

However the example requires construction of an AppConfig whose only public constructor is its Default, which results in an incorrect configuration (server's hostname, address, and whether TLS is in use). This results in incorrect values for HttRequest's app_config, connection_info and maybe url_for methods and even possibly other things?

Possible Solution

Per @robjtede it's probable that this is a gap in the public interface. Either AppConfig needs an alternative constructor or possibly actix_server::Server or its builder could construct AppConfig from the values they have.

Steps to Reproduce (for bugs)

Context

Your Environment

  • Actix Web Version: 4.2