@@ -300,43 +300,6 @@ public static class Tomcat {
300
300
*/
301
301
private final Accesslog accesslog = new Accesslog ();
302
302
303
- /**
304
- * Regular expression that matches proxies that are to be trusted.
305
- */
306
- private String internalProxies = "10\\ .\\ d{1,3}\\ .\\ d{1,3}\\ .\\ d{1,3}|" // 10/8
307
- + "192\\ .168\\ .\\ d{1,3}\\ .\\ d{1,3}|" // 192.168/16
308
- + "169\\ .254\\ .\\ d{1,3}\\ .\\ d{1,3}|" // 169.254/16
309
- + "127\\ .\\ d{1,3}\\ .\\ d{1,3}\\ .\\ d{1,3}|" // 127/8
310
- + "172\\ .1[6-9]{1}\\ .\\ d{1,3}\\ .\\ d{1,3}|" // 172.16/12
311
- + "172\\ .2[0-9]{1}\\ .\\ d{1,3}\\ .\\ d{1,3}|172\\ .3[0-1]{1}\\ .\\ d{1,3}\\ .\\ d{1,3}|" //
312
- + "0:0:0:0:0:0:0:1|::1" ;
313
-
314
- /**
315
- * Header that holds the incoming protocol, usually named "X-Forwarded-Proto".
316
- */
317
- private String protocolHeader ;
318
-
319
- /**
320
- * Value of the protocol header indicating whether the incoming request uses SSL.
321
- */
322
- private String protocolHeaderHttpsValue = "https" ;
323
-
324
- /**
325
- * Name of the HTTP header used to override the original port value.
326
- */
327
- private String portHeader = "X-Forwarded-Port" ;
328
-
329
- /**
330
- * Name of the HTTP header from which the remote IP is extracted. For instance,
331
- * `X-FORWARDED-FOR`.
332
- */
333
- private String remoteIpHeader ;
334
-
335
- /**
336
- * Name of the HTTP header from which the remote host is extracted.
337
- */
338
- private String hostHeader = "X-Forwarded-Host" ;
339
-
340
303
/**
341
304
* Tomcat base directory. If not specified, a temporary directory is used.
342
305
*/
@@ -444,7 +407,7 @@ public static class Tomcat {
444
407
/**
445
408
* Remote Ip Valve configuration.
446
409
*/
447
- private final RemoteIpValve remoteIpValve = new RemoteIpValve ();
410
+ private final Remoteip remoteip = new Remoteip ();
448
411
449
412
public int getMaxThreads () {
450
413
return this .maxThreads ;
@@ -501,40 +464,58 @@ public void setBasedir(File basedir) {
501
464
this .basedir = basedir ;
502
465
}
503
466
504
- @ DeprecatedConfigurationProperty (replacement = "server.tomcat.remote-ip-valve .internal-proxies" )
467
+ @ DeprecatedConfigurationProperty (replacement = "server.tomcat.remoteip .internal-proxies" )
505
468
public String getInternalProxies () {
506
- return this .remoteIpValve .getInternalProxies ();
469
+ return this .remoteip .getInternalProxies ();
507
470
}
508
471
509
472
public void setInternalProxies (String internalProxies ) {
510
- this .remoteIpValve .setInternalProxies (internalProxies );
473
+ this .remoteip .setInternalProxies (internalProxies );
511
474
}
512
475
513
- @ DeprecatedConfigurationProperty (replacement = "server.tomcat.remote-ip-valve .protocol-header" )
476
+ @ DeprecatedConfigurationProperty (replacement = "server.tomcat.remoteip .protocol-header" )
514
477
public String getProtocolHeader () {
515
- return this .remoteIpValve .getProtocolHeader ();
478
+ return this .remoteip .getProtocolHeader ();
516
479
}
517
480
518
481
public void setProtocolHeader (String protocolHeader ) {
519
- this .remoteIpValve .setProtocolHeader (protocolHeader );
482
+ this .remoteip .setProtocolHeader (protocolHeader );
520
483
}
521
484
522
- @ DeprecatedConfigurationProperty (replacement = "server.tomcat.remote-ip-valve .protocol-header-https-value" )
485
+ @ DeprecatedConfigurationProperty (replacement = "server.tomcat.remoteip .protocol-header-https-value" )
523
486
public String getProtocolHeaderHttpsValue () {
524
- return this .remoteIpValve .getProtocolHeaderHttpsValue ();
487
+ return this .remoteip .getProtocolHeaderHttpsValue ();
525
488
}
526
489
527
490
public void setProtocolHeaderHttpsValue (String protocolHeaderHttpsValue ) {
528
- this .remoteIpValve .setProtocolHeaderHttpsValue (protocolHeaderHttpsValue );
491
+ this .remoteip .setProtocolHeaderHttpsValue (protocolHeaderHttpsValue );
529
492
}
530
493
531
- @ DeprecatedConfigurationProperty (replacement = "server.tomcat.remote-ip-valve.port-header" )
494
+ @ DeprecatedConfigurationProperty (replacement = "server.tomcat.remoteip.host-header" )
495
+ public String getHostHeader () {
496
+ return this .remoteip .getHostHeader ();
497
+ }
498
+
499
+ public void setHostHeader (String hostHeader ) {
500
+ this .remoteip .setHostHeader (hostHeader );
501
+ }
502
+
503
+ @ DeprecatedConfigurationProperty (replacement = "server.tomcat.remote.port-header" )
532
504
public String getPortHeader () {
533
- return this .remoteIpValve .getPortHeader ();
505
+ return this .remoteip .getPortHeader ();
534
506
}
535
507
536
508
public void setPortHeader (String portHeader ) {
537
- this .remoteIpValve .setPortHeader (portHeader );
509
+ this .remoteip .setPortHeader (portHeader );
510
+ }
511
+
512
+ @ DeprecatedConfigurationProperty (replacement = "server.tomcat.remoteip.remote-ip-header" )
513
+ public String getRemoteIpHeader () {
514
+ return this .remoteip .getRemoteIpHeader ();
515
+ }
516
+
517
+ public void setRemoteIpHeader (String remoteIpHeader ) {
518
+ this .remoteip .setRemoteIpHeader (remoteIpHeader );
538
519
}
539
520
540
521
public Boolean getRedirectContextRoot () {
@@ -553,24 +534,6 @@ public void setUseRelativeRedirects(Boolean useRelativeRedirects) {
553
534
this .useRelativeRedirects = useRelativeRedirects ;
554
535
}
555
536
556
- @ DeprecatedConfigurationProperty (replacement = "server.tomcat.remote-ip-valve.remote-ip-header" )
557
- public String getRemoteIpHeader () {
558
- return this .remoteIpValve .getRemoteIpHeader ();
559
- }
560
-
561
- public void setRemoteIpHeader (String remoteIpHeader ) {
562
- this .remoteIpValve .setRemoteIpHeader (remoteIpHeader );
563
- }
564
-
565
- @ DeprecatedConfigurationProperty (replacement = "server.tomcat.remote-ip-valve.host-header" )
566
- public String getHostHeader () {
567
- return this .remoteIpValve .getHostHeader ();
568
- }
569
-
570
- public void setHostHeader (String hostHeader ) {
571
- this .remoteIpValve .setHostHeader (hostHeader );
572
- }
573
-
574
537
public Charset getUriEncoding () {
575
538
return this .uriEncoding ;
576
539
}
@@ -651,8 +614,8 @@ public Mbeanregistry getMbeanregistry() {
651
614
return this .mbeanregistry ;
652
615
}
653
616
654
- public RemoteIpValve getRemoteIpValve () {
655
- return this .remoteIpValve ;
617
+ public Remoteip getRemoteip () {
618
+ return this .remoteip ;
656
619
}
657
620
658
621
/**
@@ -941,12 +904,7 @@ public void setEnabled(boolean enabled) {
941
904
942
905
}
943
906
944
- public static class RemoteIpValve {
945
-
946
- /**
947
- * Name of the HTTP header from which the remote host is extracted.
948
- */
949
- private String hostHeader = "X-Forwarded-Host" ;
907
+ public static class Remoteip {
950
908
951
909
/**
952
910
* Regular expression that matches proxies that are to be trusted.
@@ -970,6 +928,11 @@ public static class RemoteIpValve {
970
928
*/
971
929
private String protocolHeaderHttpsValue = "https" ;
972
930
931
+ /**
932
+ * Name of the HTTP header from which the remote host is extracted.
933
+ */
934
+ private String hostHeader = "X-Forwarded-Host" ;
935
+
973
936
/**
974
937
* Name of the HTTP header used to override the original port value.
975
938
*/
@@ -981,14 +944,6 @@ public static class RemoteIpValve {
981
944
*/
982
945
private String remoteIpHeader ;
983
946
984
- public String getHostHeader () {
985
- return this .hostHeader ;
986
- }
987
-
988
- public void setHostHeader (String hostHeader ) {
989
- this .hostHeader = hostHeader ;
990
- }
991
-
992
947
public String getInternalProxies () {
993
948
return this .internalProxies ;
994
949
}
@@ -1009,6 +964,14 @@ public String getProtocolHeaderHttpsValue() {
1009
964
return this .protocolHeaderHttpsValue ;
1010
965
}
1011
966
967
+ public String getHostHeader () {
968
+ return this .hostHeader ;
969
+ }
970
+
971
+ public void setHostHeader (String hostHeader ) {
972
+ this .hostHeader = hostHeader ;
973
+ }
974
+
1012
975
public void setProtocolHeaderHttpsValue (String protocolHeaderHttpsValue ) {
1013
976
this .protocolHeaderHttpsValue = protocolHeaderHttpsValue ;
1014
977
}
0 commit comments