Commit 0dc46a2f authored by Phillip Webb's avatar Phillip Webb

Drop protocolHeader and remoteIpHeader defaults

The `protocolHeader` and `remoteIpHeader` no longer have default values
and must be opt-in.

Fixes gh-1624
parent 72ef1d65
...@@ -207,9 +207,9 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer { ...@@ -207,9 +207,9 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer {
+ "169\\.254\\.\\d{1,3}\\.\\d{1,3}|" // 169.254/16 + "169\\.254\\.\\d{1,3}\\.\\d{1,3}|" // 169.254/16
+ "127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"; // 127/8 + "127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"; // 127/8
private String protocolHeader = "x-forwarded-proto"; private String protocolHeader;
private String remoteIpHeader = "x-forwarded-for"; private String remoteIpHeader;
private File basedir; private File basedir;
......
...@@ -147,6 +147,12 @@ public class ServerPropertiesTests { ...@@ -147,6 +147,12 @@ public class ServerPropertiesTests {
@Test @Test
public void defaultTomcatRemoteIpValve() throws Exception { public void defaultTomcatRemoteIpValve() throws Exception {
Map<String, String> map = new HashMap<String, String>();
// Since 1.1.7 you need to specify at least the protocol and ip properties
map.put("server.tomcat.protocol_header", "x-forwarded-proto");
map.put("server.tomcat.remote_ip_header", "x-forwarded-for");
bindProperties(map);
TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory(); TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory();
this.properties.customize(container); this.properties.customize(container);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment