@@ -101,6 +101,11 @@ public class ServerOptions {
101101
102102 private Integer securePort ;
103103
104+ /**
105+ * Bind only https port. Default is false.
106+ */
107+ private boolean httpsOnly ;
108+
104109 private Integer compressionLevel ;
105110
106111 private Boolean http2 ;
@@ -155,6 +160,9 @@ public class ServerOptions {
155160 }
156161 // ssl
157162 SslOptions .from (conf , "server.ssl" ).ifPresent (options ::setSsl );
163+ if (conf .hasPath ("server.httpsOnly" )) {
164+ options .httpsOnly = conf .getBoolean ("server.httpsOnly" );
165+ }
158166 if (conf .hasPath ("server.http2" )) {
159167 options .setHttp2 (conf .getBoolean ("server.http2" ));
160168 }
@@ -174,6 +182,7 @@ public class ServerOptions {
174182 buff .append (", workerThreads: " ).append (getWorkerThreads ());
175183 buff .append (", bufferSize: " ).append (bufferSize );
176184 buff .append (", maxRequestSize: " ).append (maxRequestSize );
185+ buff .append (", httpsOnly: " ).append (httpsOnly );
177186 if (compressionLevel != null ) {
178187 buff .append (", gzip" );
179188 }
@@ -246,7 +255,7 @@ public boolean isSSLEnabled() {
246255 * @param securePort Port number or <code>0</code> for random number.
247256 * @return This options.
248257 */
249- public @ Nullable ServerOptions setSecurePort (@ Nullable Integer securePort ) {
258+ public @ Nonnull ServerOptions setSecurePort (@ Nullable Integer securePort ) {
250259 if (securePort == null ) {
251260 this .securePort = null ;
252261 } else {
@@ -255,6 +264,21 @@ public boolean isSSLEnabled() {
255264 return this ;
256265 }
257266
267+ /**
268+ * Bind only https port. Default is false.
269+ */
270+ public boolean isHttpsOnly () {
271+ return httpsOnly ;
272+ }
273+
274+ /**
275+ * Bind only https port. Default is false.
276+ */
277+ public @ Nonnull ServerOptions setHttpsOnly (boolean httpsOnly ) {
278+ this .httpsOnly = httpsOnly ;
279+ return this ;
280+ }
281+
258282 /**
259283 * Number of IO threads used by the server. Required by Netty and Undertow.
260284 *
0 commit comments