package water.webserver.jetty9;

import org.eclipse.jetty.client.HttpExchange;
import org.eclipse.jetty.proxy.ProxyServlet;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.client.api.Request;


/**
 * Transparent proxy that automatically adds authentication to each request
 */
public class TransparentProxyServlet extends ProxyServlet.Transparent {
  private String _basicAuth;

  @Override
  public void init(ServletConfig config) throws ServletException {
    super.init(config);
    _basicAuth = config.getInitParameter("BasicAuth");
  }

  @Override
  protected void addProxyHeaders(HttpServletRequest clientRequest,
                                 Request proxyRequest) {
    proxyRequest.getHeaders().remove("Authorization");
    proxyRequest.header("Authorization", _basicAuth);
  }
}

@@ -26,16 +26,60 @@
 etty9;%0A%0A
+import org.eclipse.jetty.client.HttpClient;%0A
 import o
@@ -116,16 +116,16 @@
 change;%0A
-
 import o
@@ -375,16 +375,69 @@
 equest;%0A
+import org.eclipse.jetty.util.ssl.SslContextFactory;%0A
 %0A%0A/**%0A *
@@ -719,16 +719,16 @@
 onfig);%0A
-
     _bas
@@ -779,16 +779,197 @@
 );%0A  %7D%0A%0A
+  @Override%0A  protected HttpClient newHttpClient() %7B%0A    final SslContextFactory sslContextFactory = new SslContextFactory(true);%0A    return new HttpClient(sslContextFactory);%0A  %7D%0A%0A
   @Overr

Enable HTTPS between Hadoop proxy and H2O Node