Hi All,
I need to create a Proxy Server using Jetty that should for HTTP and HTTPS
urls. I followed the example in http://download.eclipse.org/jetty/stable-7/xref/org/eclipse/jetty/embedded/ManyConnectors.html.
I could get the Proxy working for HTTP but not for HTTPS.
Application does not show any error message, but when I configure browser to
use this proxy and type HTTPS url, it does not load and firebug network tab
shows "Request Aborted". Can someone please suggest me what might be
wrong?
I am using Jetty 7.6.
Here is my code.
public class ManyConnectors
{
public static void main(String[] args) throws Exception
{
Server server = new Server();
SelectChannelConnector connector1 = new SelectChannelConnector();
connector1.setHost("127.0.0.1");
connector1.setPort(8888);
SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector();
ssl_connector.setHost("127.0.0.1");
ssl_connector.setPort(8443);
SslContextFactory cf = ssl_connector.getSslContextFactory();
cf.setKeyStorePath("c:\\Temp\\keystore");
cf.setKeyStoreType(KeyStore.getDefaultType());
cf.setCertAlias("jetty2");
cf.setKeyStorePassword("password");
//cf.setKeyManagerPassword("password");
server.setConnectors(new Connector[]{ connector1, ssl_connector });
ServletContextHandler contextHandler = new
ServletContextHandler(ServletContextHandler.SESSIONS);
contextHandler.setContextPath("/");
contextHandler.addFilter(HeaderFilter.class, "/*", 0);
contextHandler.addServlet(new
ServletHolder(ProxyServlet.class),"/*");
HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[] {new ConnectHandler(), contextHandler});
server.setHandler(handlers);
server.start();
server.join();
}
}
Many Thanks,
Shiv