2424import java .io .InputStream ;
2525import java .lang .management .ManagementFactory ;
2626import java .net .URL ;
27- import java .util .Arrays ;
2827import java .util .Properties ;
2928
30- import com .cloud .api .ApiServer ;
3129import org .apache .commons .daemon .Daemon ;
3230import org .apache .commons .daemon .DaemonContext ;
3331import org .apache .commons .lang3 .StringUtils ;
3432import org .eclipse .jetty .jmx .MBeanContainer ;
35- import org .eclipse .jetty .server .ForwardedRequestCustomizer ;
3633import org .eclipse .jetty .server .HttpConfiguration ;
3734import org .eclipse .jetty .server .HttpConnectionFactory ;
3835import org .eclipse .jetty .server .RequestLog ;
@@ -193,7 +190,6 @@ public void start() throws Exception {
193190 httpConfig .setResponseHeaderSize (8192 );
194191 httpConfig .setSendServerVersion (false );
195192 httpConfig .setSendDateHeader (false );
196- addForwardingCustomiser (httpConfig );
197193
198194 // HTTP Connector
199195 createHttpConnector (httpConfig );
@@ -216,21 +212,6 @@ public void start() throws Exception {
216212 server .join ();
217213 }
218214
219- /**
220- * Adds a ForwardedRequestCustomizer to the HTTP configuration to handle forwarded headers.
221- * The header used for forwarding is determined by the ApiServer.listOfForwardHeaders property.
222- * Only non empty headers are considered and only the first of the comma-separated list is used.
223- * @param httpConfig the HTTP configuration to which the customizer will be added
224- */
225- private static void addForwardingCustomiser (HttpConfiguration httpConfig ) {
226- ForwardedRequestCustomizer customiser = new ForwardedRequestCustomizer ();
227- String header = Arrays .stream (ApiServer .listOfForwardHeaders .value ().split ("," )).findFirst ().orElse (null );
228- if (com .cloud .utils .StringUtils .isNotEmpty (header )) {
229- customiser .setForwardedForHeader (header );
230- }
231- httpConfig .addCustomizer (customiser );
232- }
233-
234215 @ Override
235216 public void stop () throws Exception {
236217 server .stop ();
0 commit comments