Skip to content

Netty Web Server will not start if using Unix Domain Sockets #24529

@anupam-contaque

Description

@anupam-contaque

Spring Boot version: 2.4.1

I am trying to custmoize Spring Boot HttpServer to use unix domain socket instead of http port using

@Configuration
public class NettyConfig {

    @Bean
    public NettyReactiveWebServerFactory factory() {
        NettyReactiveWebServerFactory factory = new NettyReactiveWebServerFactory();
        factory.setServerCustomizers(Collections.singletonList(new NettyServerCustomizer() {

            @Override
            public HttpServer apply(HttpServer httpServer) {
                return httpServer.bindAddress(() -> new DomainSocketAddress("/tmp/test.sock"));
            }

        }));
        return factory;
    }
}

Error comes while NettyWebServer is trying to log port, see NettWebServer.java:109

logger.info("Netty started on port(s): " + getPort());

Linked stackoverflow question - https://stackoverflow.com/questions/65319068/unix-domain-socket-configuration-in-spring-boot-webflux

Code to reproduce the issue - uds.zip

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions