Skip to content

Commit 7551a79

Browse files
committed
Merge branch '2.2.x'
Closes gh-19422
2 parents be4c4f9 + ea00ab9 commit 7551a79

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,13 @@ private void customizeRemoteIpValve(ConfigurableTomcatWebServerFactory factory)
187187
// The internal proxies default to a white list of "safe" internal IP
188188
// addresses
189189
valve.setInternalProxies(remoteIpProperties.getInternalProxies());
190-
valve.setHostHeader(remoteIpProperties.getHostHeader());
190+
try {
191+
valve.setHostHeader(tomcatProperties.getHostHeader());
192+
}
193+
catch (NoSuchMethodError ex) {
194+
// Avoid failure with war deployments to Tomcat 8.5 before 8.5.44 and
195+
// Tomcat 9 before 9.0.23
196+
}
191197
valve.setPortHeader(remoteIpProperties.getPortHeader());
192198
valve.setProtocolHeaderHttpsValue(remoteIpProperties.getProtocolHeaderHttpsValue());
193199
// ... so it's safe to add this valve by default.

0 commit comments

Comments
 (0)