Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7928471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:44:31+00:00 2026-06-03T19:44:31+00:00

I am using Jetty’s ProxyServlet as a HTTP proxy. After I start the server

  • 0

I am using Jetty’s ProxyServlet as a HTTP proxy.

After I start the server and add the socks proxy in firefox I can access websites through the proxy without any problems.

The problem is that when I try to access a HTTPs website through the proxy. Firefox displays a “Server not found” error and during debugging I don’t see anything happening in my Java code.

Am I missing something here to add SSL support to Jetty?

Here’s part of the 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);
      } 
   }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T19:44:32+00:00Added an answer on June 3, 2026 at 7:44 pm

    You can use a “ConnectHandler”

    http://grepcode.com/file/repo1.maven.org/maven2/org.eclipse.jetty/example-jetty-embedded/8.1.1.v20120215/org/eclipse/jetty/embedded/ProxyServer.java

    public class ProxyServer {
    
        public static void main(String[] args) throws Exception {
    
            Server server = new Server();
            SelectChannelConnector connector = new SelectChannelConnector();
            connector.setPort(8888);
            server.addConnector(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();
    
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jetty server to receive calls from http clients. I am using
We're using jetty as front end http server, with cache policies. I would like
Normally, I'll start jetty (version 8) using this: java -jar -Xms1024m -Xmx1024m -server -XX:+UseConcMarkSweepGC
I am using jetty as my app server and apache as webserver to proxy
So, I am running a web server using embedded jetty and the maven app-assembler
I am using Jetty web server, and while loading JSP page, its getting loaded
I'm doing web project in tapestry by using jetty server in Eclipse. It works
I am using Jetty as my web server, and I want to do the
I'm running my webApp using Jetty with my instrumented classes. After the shutdown of
I had created a Proxy Server (Fwd and Reverse) using Java sockets. which would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.