@@ -300,43 +300,6 @@ public static class Tomcat {
300300		 */ 
301301		private  final  Accesslog  accesslog  = new  Accesslog ();
302302
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- 
340303		/** 
341304		 * Tomcat base directory. If not specified, a temporary directory is used. 
342305		 */ 
@@ -444,7 +407,7 @@ public static class Tomcat {
444407		/** 
445408		 * Remote Ip Valve configuration. 
446409		 */ 
447- 		private  final  RemoteIpValve   remoteIpValve  = new  RemoteIpValve ();
410+ 		private  final  Remoteip   remoteip  = new  Remoteip ();
448411
449412		public  int  getMaxThreads () {
450413			return  this .maxThreads ;
@@ -501,40 +464,58 @@ public void setBasedir(File basedir) {
501464			this .basedir  = basedir ;
502465		}
503466
504- 		@ DeprecatedConfigurationProperty (replacement  = "server.tomcat.remote-ip-valve .internal-proxies" )
467+ 		@ DeprecatedConfigurationProperty (replacement  = "server.tomcat.remoteip .internal-proxies" )
505468		public  String  getInternalProxies () {
506- 			return  this .remoteIpValve .getInternalProxies ();
469+ 			return  this .remoteip .getInternalProxies ();
507470		}
508471
509472		public  void  setInternalProxies (String  internalProxies ) {
510- 			this .remoteIpValve .setInternalProxies (internalProxies );
473+ 			this .remoteip .setInternalProxies (internalProxies );
511474		}
512475
513- 		@ DeprecatedConfigurationProperty (replacement  = "server.tomcat.remote-ip-valve .protocol-header" )
476+ 		@ DeprecatedConfigurationProperty (replacement  = "server.tomcat.remoteip .protocol-header" )
514477		public  String  getProtocolHeader () {
515- 			return  this .remoteIpValve .getProtocolHeader ();
478+ 			return  this .remoteip .getProtocolHeader ();
516479		}
517480
518481		public  void  setProtocolHeader (String  protocolHeader ) {
519- 			this .remoteIpValve .setProtocolHeader (protocolHeader );
482+ 			this .remoteip .setProtocolHeader (protocolHeader );
520483		}
521484
522- 		@ DeprecatedConfigurationProperty (replacement  = "server.tomcat.remote-ip-valve .protocol-header-https-value" )
485+ 		@ DeprecatedConfigurationProperty (replacement  = "server.tomcat.remoteip .protocol-header-https-value" )
523486		public  String  getProtocolHeaderHttpsValue () {
524- 			return  this .remoteIpValve .getProtocolHeaderHttpsValue ();
487+ 			return  this .remoteip .getProtocolHeaderHttpsValue ();
525488		}
526489
527490		public  void  setProtocolHeaderHttpsValue (String  protocolHeaderHttpsValue ) {
528- 			this .remoteIpValve .setProtocolHeaderHttpsValue (protocolHeaderHttpsValue );
491+ 			this .remoteip .setProtocolHeaderHttpsValue (protocolHeaderHttpsValue );
529492		}
530493
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" )
532504		public  String  getPortHeader () {
533- 			return  this .remoteIpValve .getPortHeader ();
505+ 			return  this .remoteip .getPortHeader ();
534506		}
535507
536508		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 );
538519		}
539520
540521		public  Boolean  getRedirectContextRoot () {
@@ -553,24 +534,6 @@ public void setUseRelativeRedirects(Boolean useRelativeRedirects) {
553534			this .useRelativeRedirects  = useRelativeRedirects ;
554535		}
555536
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- 
574537		public  Charset  getUriEncoding () {
575538			return  this .uriEncoding ;
576539		}
@@ -651,8 +614,8 @@ public Mbeanregistry getMbeanregistry() {
651614			return  this .mbeanregistry ;
652615		}
653616
654- 		public  RemoteIpValve   getRemoteIpValve () {
655- 			return  this .remoteIpValve ;
617+ 		public  Remoteip   getRemoteip () {
618+ 			return  this .remoteip ;
656619		}
657620
658621		/** 
@@ -941,12 +904,7 @@ public void setEnabled(boolean enabled) {
941904
942905		}
943906
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  {
950908
951909			/** 
952910			 * Regular expression that matches proxies that are to be trusted. 
@@ -970,6 +928,11 @@ public static class RemoteIpValve {
970928			 */ 
971929			private  String  protocolHeaderHttpsValue  = "https" ;
972930
931+ 			/** 
932+ 			 * Name of the HTTP header from which the remote host is extracted. 
933+ 			 */ 
934+ 			private  String  hostHeader  = "X-Forwarded-Host" ;
935+ 
973936			/** 
974937			 * Name of the HTTP header used to override the original port value. 
975938			 */ 
@@ -981,14 +944,6 @@ public static class RemoteIpValve {
981944			 */ 
982945			private  String  remoteIpHeader ;
983946
984- 			public  String  getHostHeader () {
985- 				return  this .hostHeader ;
986- 			}
987- 
988- 			public  void  setHostHeader (String  hostHeader ) {
989- 				this .hostHeader  = hostHeader ;
990- 			}
991- 
992947			public  String  getInternalProxies () {
993948				return  this .internalProxies ;
994949			}
@@ -1009,6 +964,14 @@ public String getProtocolHeaderHttpsValue() {
1009964				return  this .protocolHeaderHttpsValue ;
1010965			}
1011966
967+ 			public  String  getHostHeader () {
968+ 				return  this .hostHeader ;
969+ 			}
970+ 
971+ 			public  void  setHostHeader (String  hostHeader ) {
972+ 				this .hostHeader  = hostHeader ;
973+ 			}
974+ 
1012975			public  void  setProtocolHeaderHttpsValue (String  protocolHeaderHttpsValue ) {
1013976				this .protocolHeaderHttpsValue  = protocolHeaderHttpsValue ;
1014977			}
0 commit comments