I am using Jetty ProxyServlet as an HTTP proxy.
After starting the server and adding the socks proxy server in firefox, I can easily access websites through proxies.
The problem is that when I try to access the HTTP website through a proxy server. Firefox displays a "Server not found" error, and during debugging I donβt see anything in my Java code.
Am I missing something here to add SSL support to Jetty?
Here is the piece of code:
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); } }
Jochen
source share