Skip to content

Commit

Permalink
Protect against NoSuchMethodError when deploying to old Tomcats
Browse files Browse the repository at this point in the history
Fixes gh-19308
  • Loading branch information
wilkinsona committed Dec 20, 2019
1 parent 0e6932d commit ea00ab9
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,13 @@ private void customizeRemoteIpValve(ConfigurableTomcatWebServerFactory factory)
// The internal proxies default to a white list of "safe" internal IP
// addresses
valve.setInternalProxies(tomcatProperties.getInternalProxies());
valve.setHostHeader(tomcatProperties.getHostHeader());
try {
valve.setHostHeader(tomcatProperties.getHostHeader());
}
catch (NoSuchMethodError ex) {
// Avoid failure with war deployments to Tomcat 8.5 before 8.5.44 and
// Tomcat 9 before 9.0.23
}
valve.setPortHeader(tomcatProperties.getPortHeader());
valve.setProtocolHeaderHttpsValue(tomcatProperties.getProtocolHeaderHttpsValue());
// ... so it's safe to add this valve by default.
Expand Down

0 comments on commit ea00ab9

Please sign in to comment.