Estoy utilizando Jetty ProxyServlet como proxy HTTP.Jetty ProxyServlet con compatibilidad SSL
Después de iniciar el servidor y agregar el proxy socks en firefox, puedo acceder a los sitios web a través del proxy sin ningún problema.
El problema es que cuando intento acceder a un sitio web HTTPs a través del proxy. Firefox muestra un error de "Servidor no encontrado" y durante la depuración no veo que ocurra nada en mi código de Java.
¿Echas en falta algo aquí para agregar soporte SSL a Jetty?
Aquí es parte del código:
Server httpProxy = new Server(8087);
ServletHandler servletHandler = new ServletHandler();
servletHandler.addServletWithMapping(new ServletHolder(new TunnelProxyServlet()), "/*");
httpProxy.setHandler(servletHandler);
try {
httpProxy.start();
} catch (Exception ex) {
Logger.getLogger(HttpProxy.class.getName()).log(Level.SEVERE, null, ex);
}
public class TunnelProxyServlet extends ProxyServlet {
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
System.out.println("init done !");
}
@Override
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
System.out.println("got a request !");
super.service(req, res);
}
}
Pasando nueva SslContextFactory() información directa el constructor HttpClient no funcionará sin los archivos de configuración xml correctos. Al usar setTrustAll (verdadero) o nuevo SslContextFactory (verdadero) funcionará sin ninguna configuración adicional. PERO es una gran falla de seguridad ya que confiará ciegamente en todos los certificados. –