Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.1.5: Enables support to turn on/off proxy protocol in config #9579

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ interface ListenerConfigBlueprint {
*
* @return proxy support status
*/
@Option.Configured
@Option.Default("false")
boolean enableProxyProtocol();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,24 @@ void testSpecificListenerConfigFromConfigFile() {
assertThat(listenerConfig.shutdownGracePeriod().toMillis(), is(2000L));
}

@Test
void testEnableProxyProtocolConfig() {
Config config = Config.create();

// default is false in default socket
var webServerConfig = WebServer.builder().config(config.get("server")).buildPrototype();
assertThat(webServerConfig.enableProxyProtocol(), is(false));
ListenerConfig otherConfig = webServerConfig.sockets().get("other");
assertThat(otherConfig.enableProxyProtocol(), is(false));

// set to true in default socket
var webServerConfig2 = WebServer.builder().config(config.get("server2")).buildPrototype();
assertThat(webServerConfig2.enableProxyProtocol(), is(true));

// set to true in non-default socket
var webServerConfig3 = WebServer.builder().config(config.get("server3")).buildPrototype();
assertThat(webServerConfig3.enableProxyProtocol(), is(false));
ListenerConfig graceConfig = webServerConfig3.sockets().get("grace");
assertThat(graceConfig.enableProxyProtocol(), is(true));
}
}
4 changes: 3 additions & 1 deletion webserver/webserver/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2022, 2023 Oracle and/or its affiliates.
# Copyright (c) 2022, 2024 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -45,6 +45,7 @@ server2:
port: 8079
host: 127.0.0.1
shutdown-grace-period: PT1S
enable-proxy-protocol: true

connection-providers-discover-services: false
media-context:
Expand All @@ -57,6 +58,7 @@ server3:
sockets:
- name: "grace"
shutdown-grace-period: PT2S
enable-proxy-protocol: true

inject:
permits-dynamic: true