File tree Expand file tree Collapse file tree
main/java/io/helidon/webserver
java/io/helidon/webserver Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -366,6 +366,7 @@ interface ListenerConfigBlueprint {
366366 *
367367 * @return proxy support status
368368 */
369+ @ Option .Configured
369370 @ Option .Default ("false" )
370371 boolean enableProxyProtocol ();
371372
Original file line number Diff line number Diff line change @@ -57,4 +57,24 @@ void testSpecificListenerConfigFromConfigFile() {
5757 assertThat (listenerConfig .shutdownGracePeriod ().toMillis (), is (2000L ));
5858 }
5959
60+ @ Test
61+ void testEnableProxyProtocolConfig () {
62+ Config config = Config .create ();
63+
64+ // default is false in default socket
65+ var webServerConfig = WebServer .builder ().config (config .get ("server" )).buildPrototype ();
66+ assertThat (webServerConfig .enableProxyProtocol (), is (false ));
67+ ListenerConfig otherConfig = webServerConfig .sockets ().get ("other" );
68+ assertThat (otherConfig .enableProxyProtocol (), is (false ));
69+
70+ // set to true in default socket
71+ var webServerConfig2 = WebServer .builder ().config (config .get ("server2" )).buildPrototype ();
72+ assertThat (webServerConfig2 .enableProxyProtocol (), is (true ));
73+
74+ // set to true in non-default socket
75+ var webServerConfig3 = WebServer .builder ().config (config .get ("server3" )).buildPrototype ();
76+ assertThat (webServerConfig3 .enableProxyProtocol (), is (false ));
77+ ListenerConfig graceConfig = webServerConfig3 .sockets ().get ("grace" );
78+ assertThat (graceConfig .enableProxyProtocol (), is (true ));
79+ }
6080}
Original file line number Diff line number Diff line change 11#
2- # Copyright (c) 2022, 2023 Oracle and/or its affiliates.
2+ # Copyright (c) 2022, 2024 Oracle and/or its affiliates.
33#
44# Licensed under the Apache License, Version 2.0 (the "License");
55# you may not use this file except in compliance with the License.
@@ -45,6 +45,7 @@ server2:
4545 port : 8079
4646 host : 127.0.0.1
4747 shutdown-grace-period : PT1S
48+ enable-proxy-protocol : true
4849
4950 connection-providers-discover-services : false
5051 media-context :
@@ -57,6 +58,7 @@ server3:
5758 sockets :
5859 - name : " grace"
5960 shutdown-grace-period : PT2S
61+ enable-proxy-protocol : true
6062
6163inject :
6264 permits-dynamic : true
You can’t perform that action at this time.
0 commit comments