mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Drop protocolHeader and remoteIpHeader defaults
The `protocolHeader` and `remoteIpHeader` no longer have default values and must be opt-in. Fixes gh-1624
This commit is contained in:
parent
72ef1d6554
commit
0dc46a2fe7
@ -207,9 +207,9 @@ public class ServerProperties implements EmbeddedServletContainerCustomizer {
|
||||
+ "169\\.254\\.\\d{1,3}\\.\\d{1,3}|" // 169.254/16
|
||||
+ "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;
|
||||
|
||||
|
@ -147,6 +147,12 @@ public class ServerPropertiesTests {
|
||||
|
||||
@Test
|
||||
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();
|
||||
this.properties.customize(container);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user