|
|
@ -23,6 +23,7 @@ import java.util.Arrays;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import reactor.netty.http.HttpProtocol;
|
|
|
|
import reactor.netty.http.server.HttpServer;
|
|
|
|
import reactor.netty.http.server.HttpServer;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory;
|
|
|
|
import org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory;
|
|
|
@ -110,10 +111,10 @@ public class NettyReactiveWebServerFactory extends AbstractReactiveWebServerFact
|
|
|
|
|
|
|
|
|
|
|
|
private HttpServer createHttpServer() {
|
|
|
|
private HttpServer createHttpServer() {
|
|
|
|
HttpServer server = HttpServer.create().tcpConfiguration(
|
|
|
|
HttpServer server = HttpServer.create().tcpConfiguration(
|
|
|
|
(tcpServer) -> tcpServer.addressSupplier(() -> getListenAddress()));
|
|
|
|
(tcpServer) -> tcpServer.addressSupplier(this::getListenAddress));
|
|
|
|
if (getSsl() != null && getSsl().isEnabled()) {
|
|
|
|
if (getSsl() != null && getSsl().isEnabled()) {
|
|
|
|
SslServerCustomizer sslServerCustomizer = new SslServerCustomizer(getSsl(),
|
|
|
|
SslServerCustomizer sslServerCustomizer = new SslServerCustomizer(getSsl(),
|
|
|
|
getSslStoreProvider());
|
|
|
|
getHttp2(), getSslStoreProvider());
|
|
|
|
server = sslServerCustomizer.apply(server);
|
|
|
|
server = sslServerCustomizer.apply(server);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (getCompression() != null && getCompression().getEnabled()) {
|
|
|
|
if (getCompression() != null && getCompression().getEnabled()) {
|
|
|
@ -121,10 +122,23 @@ public class NettyReactiveWebServerFactory extends AbstractReactiveWebServerFact
|
|
|
|
getCompression());
|
|
|
|
getCompression());
|
|
|
|
server = compressionCustomizer.apply(server);
|
|
|
|
server = compressionCustomizer.apply(server);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
server = server.protocol(listProtocols());
|
|
|
|
server = (this.useForwardHeaders ? server.forwarded() : server.noForwarded());
|
|
|
|
server = (this.useForwardHeaders ? server.forwarded() : server.noForwarded());
|
|
|
|
return applyCustomizers(server);
|
|
|
|
return applyCustomizers(server);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private HttpProtocol[] listProtocols() {
|
|
|
|
|
|
|
|
if (getHttp2() != null && getHttp2().isEnabled()) {
|
|
|
|
|
|
|
|
if (getSsl() != null && getSsl().isEnabled()) {
|
|
|
|
|
|
|
|
return new HttpProtocol[] { HttpProtocol.H2, HttpProtocol.HTTP11 };
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
return new HttpProtocol[] { HttpProtocol.H2C, HttpProtocol.HTTP11 };
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new HttpProtocol[] { HttpProtocol.HTTP11 };
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private InetSocketAddress getListenAddress() {
|
|
|
|
private InetSocketAddress getListenAddress() {
|
|
|
|
if (getAddress() != null) {
|
|
|
|
if (getAddress() != null) {
|
|
|
|
return new InetSocketAddress(getAddress().getHostAddress(), getPort());
|
|
|
|
return new InetSocketAddress(getAddress().getHostAddress(), getPort());
|
|
|
|