Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Need help with embedded Jetty Proxy Server

Thanks Simone for the response.

I tried the example you that pointed, but the result is same.
When I use Ssl ( I added SslSelectChannelConnector for it and provided CA signed certificate), it does not bring the secured pages.

This pages work :-  http://www.google.com
This page doesn't work : https://www.google.com

I also tried whitelisted other ssl pages, but no luck.

Please see code below and let me know if I am missing something ?

Also, I extended SslSelectChannelConnector just to add some logging. I see that it accept() and open() the connection, but then immediately close() the connection.

Where can I get the logs for connector operations ?

Here is the code that I tried.

        Server server = new Server();
        SelectChannelConnector connector = new SelectChannelConnector();
        connector.setPort(8080);
        server.addConnector(connector);

        SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector();
        ssl_connector.setPort(8443);
        SslContextFactory cf = ssl_connector.getSslContextFactory();
        cf.setKeyStorePath(".\\cert\\Jetty.jks");
        cf.setKeyStoreType(KeyStore.getDefaultType());
        //cf.setCertAlias("Jetty");
        cf.setKeyStorePassword("password");
        cf.setKeyManagerPassword("password");
        server.addConnector(ssl_connector);

        HandlerCollection handlers = new HandlerCollection();
        server.setHandler(handlers);

        // Setup proxy servlet
        ServletContextHandler context = new ServletContextHandler(handlers, "/", ServletContextHandler.SESSIONS);
        ServletHolder proxyServlet = new ServletHolder(ProxyServlet.class);
        proxyServlet.setInitParameter("whiteList","google.com, www.eclipse.org, localhost");
        proxyServlet.setInitParameter("blackList","google.com/calendar/*, www.eclipse.org/committers/");
        context.addServlet(proxyServlet, "/*");

        // Setup proxy handler to handle CONNECT methods
        ConnectHandler proxy = new ConnectHandler();
        proxy.setWhite(new String[] { "mail.google.com" });
        proxy.addWhite("www.google.com");
        handlers.addHandler(proxy);

        server.start();


Thanks,
Shiv



On Tue, Jul 23, 2013 at 1:07 AM, Simone Bordet <sbordet@xxxxxxxxxxx> wrote:
Hi,

On Mon, Jul 22, 2013 at 7:56 PM, Shiv Kumbhar <shivshankar.k@xxxxxxxxx> wrote:
> 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.

Please use http://download.eclipse.org/jetty/stable-7/xref/org/eclipse/jetty/embedded/ProxyServer.html.

--
Simone Bordet
----
http://cometd.org
http://webtide.com
http://intalio.com
Developer advice, training, services and support
from the Jetty & CometD experts.
Intalio, the modern way to build business applications.
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top